diff --git a/frontend/sync-client/src/persistence/settings.ts b/frontend/sync-client/src/persistence/settings.ts index d78170e6..944f6980 100644 --- a/frontend/sync-client/src/persistence/settings.ts +++ b/frontend/sync-client/src/persistence/settings.ts @@ -56,7 +56,10 @@ export class Settings { } public getSettings(): SyncSettings { - return this.settings; + return { + ...this.settings, + ignorePatterns: [...this.settings.ignorePatterns] + }; } public async setSetting( @@ -74,21 +77,14 @@ export class Settings { `Updating settings with: ${JSON.stringify(value)}` ); const oldSettings = this.settings; - this.settings = { - ...this.settings, - ...value - }; + const next = { ...this.settings, ...value }; + await this.saveData(next); + this.settings = next; await this.onSettingsChanged.triggerAsync( - this.settings, + this.getSettings(), oldSettings ); - - await this.save(); }); } - - private async save(): Promise { - await this.saveData(this.settings); - } }