Skip to content

Commit

Permalink
fix(settings): Fix some settings being overwritten with default values
Browse files Browse the repository at this point in the history
Closes #1353.
  • Loading branch information
tcrammond committed Mar 21, 2019
1 parent 03a3cd6 commit b5c94bf
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/scripts/lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,10 @@ export default class Db {

async load (setting, defaultValue) {
let value = await this.get(setting);

// Attempt to migrate from old localStorage settings.
if (value === null || typeof value === 'undefined') {
value = localStorage.getItem(setting);
if (value && typeof defaultValue === 'boolean') {
value = JSON.parse(value);
}
if (typeof value === 'undefined') {
value = defaultValue;
}

value = value || defaultValue;
this.set(setting, value);
return value;
}
Expand Down

0 comments on commit b5c94bf

Please sign in to comment.