Skip to content

Commit

Permalink
fix: prefs-manager set pref null to remove this
Browse files Browse the repository at this point in the history
  • Loading branch information
northword committed Jan 11, 2025
1 parent ea59bc3 commit b52923d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/scaffold/src/utils/prefs-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pref("test.boolean.true", true);
it("should correctly set a null value and remove the preference", () => {
prefsManager.setPref("test.null", "value");
prefsManager.setPref("test.null", null);
expect(prefsManager.getPrefs()).toEqual({});
expect(prefsManager.getPref("test.null")).toBeUndefined();
});
});
Expand Down
3 changes: 1 addition & 2 deletions packages/scaffold/src/utils/prefs-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ export class PrefsManager {
if (value === null || value === undefined) {
if (key in this.prefs)
delete this.prefs[key];
else
return;
return;
}

this.prefs[key] = value;
Expand Down

0 comments on commit b52923d

Please sign in to comment.