Skip to content

Commit c90d38b

Browse files
committed
accept undefined config value
1 parent 792fb67 commit c90d38b

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

lib/Models/TerriaConfig.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,13 @@ export class TerriaConfig {
368368

369369
/**
370370
* Merges `partial` into this config. Only fields present in
371-
* `ConfigParameters` are accepted; `undefined` values do not overwrite
372-
* existing values.
371+
* `ConfigParameters` are accepted.
373372
*/
374373
@action
375374
update(partial: Partial<ConfigParameters>): void {
376375
(Object.entries(partial) as [keyof TerriaConfig, unknown][]).forEach(
377376
([key, value]) => {
378-
if (key in this && value !== undefined) {
377+
if (key in this) {
379378
(this as any)[key] = value;
380379
}
381380
}

test/Models/TerriaConfigSpec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ describe("TerriaConfig", function () {
4242
expect(config.supportEmail).toBe("[email protected]"); // default unchanged
4343
});
4444

45-
it("does not overwrite existing value when undefined is applied", function () {
46-
const config = new TerriaConfig();
47-
config.update({ appName: undefined });
48-
49-
expect(config.appName).toBe("TerriaJS App");
50-
});
51-
5245
it("uses last value when the same field is applied twice", function () {
5346
const config = new TerriaConfig();
5447
config.update({ appName: "First" });

0 commit comments

Comments
 (0)