From d1302c0389838e3a92a28a4730e4dd8a915ab86f Mon Sep 17 00:00:00 2001 From: ymekuria Date: Sun, 22 Sep 2024 21:47:46 -0700 Subject: [PATCH] refactor(index.page.tsx): remove unnecessary IIFE and improve readability by defining checkAccountExists function separately --- .../zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx index bd574e4ad..60ffe60d6 100644 --- a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx +++ b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx @@ -27,7 +27,6 @@ export default function Home() { // Do Setup useEffect(() => { - const setup = async () => { try { if (!state.hasBeenSetup) { @@ -107,7 +106,7 @@ export default function Home() { // Wait for account to exist, if it didn't useEffect(() => { - (async () => { + const checkAccountExists = async () => { if (state.hasBeenSetup && !state.accountExists) { for (;;) { setDisplayText('Checking if fee payer account exists...'); @@ -121,7 +120,9 @@ export default function Home() { } setState({ ...state, accountExists: true }); } - })(); + }; + + checkAccountExists(); }, [state.hasBeenSetup]); // -------------------------------------------------------