Skip to content

Commit

Permalink
fix(presets): auto-switch theme checkbox values not loaded correctly (@…
Browse files Browse the repository at this point in the history
…amarnathsama) (#5826)

* fixed bug where presets wouldnt change auto light and dark theme checkbox values

* mode code to setting.ts

* updated variable name

* updated setting.ts
  • Loading branch information
amarnathsama authored Aug 29, 2024
1 parent faf522f commit 253efb7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/src/ts/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1315,10 +1315,18 @@ export function setEventDisabled(value: boolean): void {
configEventDisabled = value;
}

ConfigEvent.subscribe((eventKey) => {
ConfigEvent.subscribe((eventKey, eventValue) => {
if (eventKey === "fullConfigChange") setEventDisabled(true);
if (eventKey === "fullConfigChangeFinished") setEventDisabled(false);

if (eventKey === "themeLight") {
$(
`.pageSettings .section[data-config-name='autoSwitchThemeInputs'] select.light option[value="${eventValue}"]`
).attr("selected", "true");
} else if (eventKey === "themeDark") {
$(
`.pageSettings .section[data-config-name='autoSwitchThemeInputs'] select.dark option[value="${eventValue}"]`
).attr("selected", "true");
}
//make sure the page doesnt update a billion times when applying a preset/config at once
if (configEventDisabled || eventKey === "saveToLocalStorage") return;
if (ActivePage.get() === "settings" && eventKey !== "theme") {
Expand Down

0 comments on commit 253efb7

Please sign in to comment.