From 253efb73406ba0607dab387a7a02e4b05ce91b9c Mon Sep 17 00:00:00 2001 From: amarnathsama <63007641+amarnathsama@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:10:19 +0530 Subject: [PATCH] fix(presets): auto-switch theme checkbox values not loaded correctly (@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 --- frontend/src/ts/pages/settings.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/pages/settings.ts b/frontend/src/ts/pages/settings.ts index 560efb05247c..6c3b2da93bd3 100644 --- a/frontend/src/ts/pages/settings.ts +++ b/frontend/src/ts/pages/settings.ts @@ -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") {