diff --git a/src/services/wiki/index.ts b/src/services/wiki/index.ts index 271fa9e9..5d8b983b 100644 --- a/src/services/wiki/index.ts +++ b/src/services/wiki/index.ts @@ -566,10 +566,18 @@ export class Wiki implements IWikiService { const syncDebounceInterval = await this.preferenceService.get('syncDebounceInterval'); this.wikiSyncIntervals[id] = setInterval(async () => { await this.syncWikiIfNeeded(workspace); + // sync all subwiki together, if main workspace set to sync + await this.syncAllSubWikiIfNeeded(workspace); }, syncDebounceInterval); } } + private async syncAllSubWikiIfNeeded(workspace: IWorkspace) { + const workspaces = await this.workspaceService.getWorkspacesAsList(); + const subWikiWorkspaces = workspaces.filter((w) => w.mainWikiID === workspace.id); + await Promise.all(subWikiWorkspaces.map((w) => this.syncWikiIfNeeded(w))); + } + private stopIntervalSync(workspace: IWorkspace): void { const { id } = workspace; if (typeof this.wikiSyncIntervals[id] === 'number') {