mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-25 22:11:35 -08:00
feat: sync all subwiki together, if main workspace set to sync
fixes #397
This commit is contained in:
parent
731d756928
commit
0473ea177f
1 changed files with 8 additions and 0 deletions
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue