Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix: reset certs sub on subnet change (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Jan 29, 2024
1 parent 3aba479 commit dc8da39
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/hooks/useSubnetSubscribeToCertificates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ export default function useSubnetSubscribeToCertificates({ filter }: Options) {
},
})

useEffect(() => {
if (data && data.watchDeliveredCertificates) {
setCertificates((c) => [data.watchDeliveredCertificates, ...c])
}
}, [data])
useEffect(
function onNewFilter() {
setCertificates([])
},
[filter?.source]
)

useEffect(
function onNewCertificates() {
if (data && data.watchDeliveredCertificates) {
setCertificates((c) => [data.watchDeliveredCertificates, ...c])
}
},
[data]
)

return { certificates, error, loading }
}

0 comments on commit dc8da39

Please sign in to comment.