From 3ec30fa98d2ad6588e92cacd7fed198a5285e59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=80=E4=BA=8C?= Date: Wed, 9 Jun 2021 00:30:57 +0800 Subject: [PATCH] fix: wiki still try to load view of bad folder workspace --- src/services/workspacesView/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/workspacesView/index.ts b/src/services/workspacesView/index.ts index 9228d567..9dc7cf49 100644 --- a/src/services/workspacesView/index.ts +++ b/src/services/workspacesView/index.ts @@ -15,6 +15,7 @@ import { IPreferenceService } from '@services/preferences/interface'; import { logger } from '@services/libs/log'; import { IAuthenticationService } from '@services/auth/interface'; import { IGitService } from '@services/git/interface'; +import { IWikiService } from '@services/wiki/interface'; import { IWorkspaceViewService } from './interface'; import { lazyInject } from '@services/container'; import { SupportedStorageServices } from '@services/types'; @@ -24,6 +25,7 @@ export class WorkspaceView implements IWorkspaceViewService { @lazyInject(serviceIdentifier.Authentication) private readonly authService!: IAuthenticationService; @lazyInject(serviceIdentifier.View) private readonly viewService!: IViewService; @lazyInject(serviceIdentifier.Git) private readonly gitService!: IGitService; + @lazyInject(serviceIdentifier.Wiki) private readonly wikiService!: IWikiService; @lazyInject(serviceIdentifier.Workspace) private readonly workspaceService!: IWorkspaceService; @lazyInject(serviceIdentifier.Window) private readonly windowService!: IWindowService; @lazyInject(serviceIdentifier.Preference) private readonly preferenceService!: IPreferenceService; @@ -53,6 +55,9 @@ export class WorkspaceView implements IWorkspaceViewService { if (!workspace.isSubWiki) { await this.viewService.addView(mainWindow, workspace); } + if ((await this.wikiService.checkWikiExist(workspace.wikiFolderLocation, true)) === true) { + continue; + } const userInfo = await this.authService.getStorageServiceUserInfo(workspace.storageService); const { wikiFolderLocation, gitUrl: githubRepoUrl, storageService } = workspace; // wait for main wiki's watch-fs plugin to be fully initialized