From ca322db212573c8ba66bc7c529eec729c228e0eb Mon Sep 17 00:00:00 2001 From: Divyanshu Agrawal Date: Mon, 17 Jun 2024 00:42:03 +0530 Subject: [PATCH] Fix initial state bug. --- src/webview/frontend/App.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webview/frontend/App.tsx b/src/webview/frontend/App.tsx index 6ee7d9b..e6050a3 100644 --- a/src/webview/frontend/App.tsx +++ b/src/webview/frontend/App.tsx @@ -40,10 +40,12 @@ function Judge(props: { const [webviewState, setWebviewState] = useState( () => { const vscodeState = vscodeApi.getState(); - console.log('Restored state:', vscodeState); - return { + let ret = { dialogCloseDate: vscodeState?.dialogCloseDate || Date.now(), }; + vscodeApi.setState(ret); + console.log('Restored to state:', ret); + return ret; }, );