From bca7b9106a83bb1eac05068f50af9ce09efd03b8 Mon Sep 17 00:00:00 2001 From: javiersuweijie Date: Tue, 23 Jul 2024 23:12:54 +0800 Subject: [PATCH] feat: use inputWorkers to check if worker is ready --- packages/app/src/pages/MainPage.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/app/src/pages/MainPage.tsx b/packages/app/src/pages/MainPage.tsx index 6070a59..606267a 100644 --- a/packages/app/src/pages/MainPage.tsx +++ b/packages/app/src/pages/MainPage.tsx @@ -38,7 +38,6 @@ const CIRCUIT_NAME = "twitter"; export const MainPage: React.FC<{}> = (props) => { const { address } = useAccount(); - const workers = new Map(); const { googleAuthToken, @@ -199,14 +198,9 @@ export const MainPage: React.FC<{}> = (props) => { }); useEffect(() => { - if (workers.get("zk-email/proof-of-twitter-v2")) { - return; + if (!inputWorkers["zk-email/proof-of-twitter-v2"]) { + createInputWorker("zk-email/proof-of-twitter-v2"); } - console.log("something") - createInputWorker("zk-email/proof-of-twitter-v2"); - console.log("something2") - workers.set("zk-email/proof-of-twitter-v2", true); - // setWorkerReady(true); }, []); // local storage stuff @@ -543,6 +537,7 @@ export const MainPage: React.FC<{}> = (props) => { {displayMessage}