From a9d0478e3c5cc72e6eb5136d80c5a49de092deb9 Mon Sep 17 00:00:00 2001 From: "Jason M. Hasperhoven" Date: Wed, 28 Aug 2024 13:52:02 +0400 Subject: [PATCH] Remove usePopupReady arg --- apps/extension/src/hooks/popup-ready.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/extension/src/hooks/popup-ready.ts b/apps/extension/src/hooks/popup-ready.ts index 3123da63..38cc0a88 100644 --- a/apps/extension/src/hooks/popup-ready.ts +++ b/apps/extension/src/hooks/popup-ready.ts @@ -1,19 +1,17 @@ import { useEffect, useRef } from 'react'; import { useSearchParams } from 'react-router-dom'; -type IsReady = boolean | undefined; - // signals that react is ready (mounted) to service worker -export const usePopupReady = (isReady: IsReady = undefined) => { +export const usePopupReady = () => { const sentMessagesRef = useRef(new Set()); const [searchParams] = useSearchParams(); const popupId = searchParams.get('popupId'); useEffect(() => { - if (popupId && (isReady === undefined || isReady) && !sentMessagesRef.current.has(popupId)) { + if (popupId && !sentMessagesRef.current.has(popupId)) { sentMessagesRef.current.add(popupId); void chrome.runtime.sendMessage(popupId); } - }, [popupId, isReady]); + }, [popupId]); };