diff --git a/crates/lanspread-tauri-deno-ts/src/App.tsx b/crates/lanspread-tauri-deno-ts/src/App.tsx index 1c9cf7c..696131b 100644 --- a/crates/lanspread-tauri-deno-ts/src/App.tsx +++ b/crates/lanspread-tauri-deno-ts/src/App.tsx @@ -156,7 +156,7 @@ const App = () => { }; }, []); - const getInitialGameDir = async () => { + const getInitialGameDir = useCallback(async () => { // update game directory from storage (if exists) // only if it's not already set await new Promise(resolve => setTimeout(resolve, 1000)); @@ -165,7 +165,11 @@ const App = () => { if (savedGameDir) { setGameDir(savedGameDir); } - }; + }, []); + + useEffect(() => { + void getInitialGameDir(); + }, [getInitialGameDir]); useEffect(() => { // Listen for game-download-failed events specifically @@ -330,7 +334,7 @@ const App = () => { }; }); }); - getInitialGameDir(); + void getInitialGameDir(); }); // Listen for game-download-begin events