From 75be55d2553c55ecaac9e621e350ce44bb0c1c27 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Fri, 14 Nov 2025 10:44:02 +0100 Subject: [PATCH] remember game dir --- crates/lanspread-tauri-deno-ts/src/App.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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