Skip to content

Commit

Permalink
Merge saved custom themes on top of defaultConfig when loading, to en…
Browse files Browse the repository at this point in the history
…sure they get any new default config fields.
  • Loading branch information
mcglincy committed Dec 13, 2021
1 parent f9663f6 commit e653d46
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.13.1

- Fix bug where custom themes wouldn't get defaults for new config settings.

# 0.13.0

- Make Dungeon Draw compatible with Foundry v9.
Expand Down
2 changes: 1 addition & 1 deletion modules/dungeondraw-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/dungeondraw-bundle.min.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ export const getCustomThemes = () => {
constants.MODULE_NAME,
"customThemes"
);
return JSON.parse(customThemesString);
const themeObj = JSON.parse(customThemesString);
// ensure saved custom themes get any new defaults
Object.keys(themeObj).forEach((key) => {
themeObj[key].config = foundry.utils.mergeObject(
defaultConfig(),
themeObj[key].config
);
});
console.log(themeObj);
return themeObj;
} catch (e) {
console.log(e);
return {};
Expand Down

0 comments on commit e653d46

Please sign in to comment.