diff --git a/src/core/public/ui_settings/ui_settings_client.ts b/src/core/public/ui_settings/ui_settings_client.ts index 47dc2b3bc3e6f..e23fb9c6891a8 100644 --- a/src/core/public/ui_settings/ui_settings_client.ts +++ b/src/core/public/ui_settings/ui_settings_client.ts @@ -34,7 +34,7 @@ export class UiSettingsClient implements IUiSettingsClient { constructor(params: UiSettingsClientParams) { this.api = params.api; this.defaults = cloneDeep(params.defaults); - this.cache = defaultsDeep({ ...this.defaults }, params.initialSettings); + this.cache = defaultsDeep({}, this.defaults, params.initialSettings); params.done$.subscribe({ complete: () => { @@ -177,7 +177,7 @@ You can use \`IUiSettingsClient.get("${key}", defaultValue)\`, which will just r try { const { settings } = await this.api.batchSet(key, newVal); - this.cache = defaultsDeep({ ...defaults }, settings); + this.cache = defaultsDeep({}, defaults, settings); this.saved$.next({ key, newValue: newVal, oldValue: initialVal }); return true; } catch (error) { diff --git a/src/core/server/ui_settings/ui_settings_client.ts b/src/core/server/ui_settings/ui_settings_client.ts index 11a061ab49497..ae7eb04caea61 100644 --- a/src/core/server/ui_settings/ui_settings_client.ts +++ b/src/core/server/ui_settings/ui_settings_client.ts @@ -152,7 +152,7 @@ export class UiSettingsClient implements IUiSettingsClient { } const userProvided = await this.getUserProvided(); - const result = defaultsDeep({ ...userProvided }, this.defaults); + const result = defaultsDeep({}, userProvided, this.defaults); this.rawCache.set(result);