diff --git a/src/hooks/useSubnetSubscribeToCertificates.tsx b/src/hooks/useSubnetSubscribeToCertificates.tsx index fbdcb9f..910bb69 100644 --- a/src/hooks/useSubnetSubscribeToCertificates.tsx +++ b/src/hooks/useSubnetSubscribeToCertificates.tsx @@ -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 } }