From 09b44a3af340c3ed5391671aacf024240ff858c2 Mon Sep 17 00:00:00 2001 From: nhsmw Date: Fri, 19 Jul 2024 10:32:41 +0800 Subject: [PATCH] fix: update test url --- src/components/test/test-item.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/test/test-item.tsx b/src/components/test/test-item.tsx index 8b5c901..8d57089 100644 --- a/src/components/test/test-item.tsx +++ b/src/components/test/test-item.tsx @@ -28,7 +28,7 @@ interface Props { onDelete: (uid: string) => void; } -let eventListener: UnlistenFn | null = null; +let eventListener: UnlistenFn = () => {}; export const TestItem = (props: Props) => { const { itemData, onEdit, onDelete: onDeleteItem } = props; @@ -90,9 +90,7 @@ export const TestItem = (props: Props) => { ]; const listenTsetEvent = async () => { - if (eventListener !== null) { - eventListener(); - } + eventListener(); eventListener = await listen("verge://test-all", () => { onDelay(); }); @@ -100,7 +98,7 @@ export const TestItem = (props: Props) => { useEffect(() => { listenTsetEvent(); - }, []); + }, [url]); return (