From 7fca5538236bc33a51b121e35f864d7ce51d91eb Mon Sep 17 00:00:00 2001 From: clean99 Date: Mon, 20 Nov 2023 12:40:04 +0800 Subject: [PATCH] feat: replace setting state using persisted hook --- frontend/src/App.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index f579882..72bd672 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,6 +21,7 @@ import { Settings } from "./types"; import { IS_RUNNING_ON_CLOUD } from "./config"; import { PicoBadge } from "./components/PicoBadge"; import { OnboardingNote } from "./components/OnboardingNote"; +import { usePersistedState } from "./hooks/usePersistedState"; function App() { const [appState, setAppState] = useState<"INITIAL" | "CODING" | "CODE_READY">( @@ -31,11 +32,11 @@ function App() { const [executionConsole, setExecutionConsole] = useState([]); const [updateInstruction, setUpdateInstruction] = useState(""); const [history, setHistory] = useState([]); - const [settings, setSettings] = useState({ + const [settings, setSettings] = usePersistedState({ openAiApiKey: null, isImageGenerationEnabled: true, editorTheme: "cobalt" - }); + }, 'setting'); const downloadCode = () => { // Create a blob from the generated code