Skip to content

Commit 4e9b490

Browse files
committed
Restore a local setting that matched the server's override
A local value equal to the incoming server value wasn't saved, so it was deleted when the server later stopped sending that key.
1 parent ed4cdbf commit 4e9b490

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎packages/core/src/configuration/Configuration.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ export class Configuration {
563563
}
564564

565565
for (const [key, setting] of Object.entries(received)) {
566-
if (key in settings && settings[key] !== setting) {
566+
// Server-owned keys were removed above, so any remaining value is local, even if it equals the server value.
567+
if (key in settings) {
567568
this._overriddenLocalSettings[key] = settings[key];
568569
}
569570

‎packages/core/test/ExceptionlessClientLifecycle.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,23 @@ describe("Server settings", () => {
266266
expect(config.settings["@@log:*"]).toBe("info");
267267
});
268268

269+
test("restores a local setting that matched the server override", () => {
270+
const config = new Configuration();
271+
config.settings["@@log:*"] = "off";
272+
273+
config.applyServerSettings(
274+
new ServerSettings(
275+
{
276+
"@@log:*": "off"
277+
},
278+
1
279+
)
280+
);
281+
config.applyServerSettings(new ServerSettings({}, 2));
282+
283+
expect(config.settings["@@log:*"]).toBe("off");
284+
});
285+
269286
test("ignores server settings that are not strings", () => {
270287
const config = new Configuration();
271288

0 commit comments

Comments
 (0)