From b2fe4b0981abaa4d2e0f55abe9d0a4f42035bbd0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 30 Aug 2022 15:57:51 +0200 Subject: [PATCH] set current workspace to the first one by default --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 7aef284f10..ef4ac18ad0 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -26,7 +26,11 @@ export function Workspace () { const initGitRepoRef = useRef() useEffect(() => { - setCurrentWorkspace(localStorage.getItem('currentWorkspace') ? localStorage.getItem('currentWorkspace') : '') + let workspaceName = localStorage.getItem('currentWorkspace') + if (!workspaceName && global.fs.browser.workspaces.length) { + workspaceName = global.fs.browser.workspaces[0].name + } + setCurrentWorkspace(workspaceName) resetFocus() }, [])