fix: logic after delete all workspaces (#2587)

Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
Himself65
2023-05-31 12:24:14 +08:00
committed by GitHub
parent 1c7ae04f4f
commit 8dbd354659
11 changed files with 100 additions and 77 deletions

View File

@@ -46,7 +46,11 @@ rootWorkspacesMetadataAtom.onMount = setAtom => {
const id = setTimeout(() => {
setAtom(metadata => {
if (abortController.signal.aborted) return metadata;
if (metadata.length === 0) {
if (
metadata.length === 0 &&
localStorage.getItem('is-first-open') === null
) {
localStorage.setItem('is-first-open', 'false');
const newMetadata = createFirst();
logger.info('create first workspace', newMetadata);
return newMetadata;