mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(web): set theme before app loads (#1017)
* chore(web): toggle classList instead of add and remove * fix(web): set theme before the app loads
This commit is contained in:
parent
daa4bf9a0f
commit
6c2f3a4b2b
2 changed files with 5 additions and 6 deletions
|
@ -72,12 +72,7 @@ export const SettingsContext = newRidgeState<SettingsType>(
|
|||
{
|
||||
onSet: (new_state) => {
|
||||
try {
|
||||
if (new_state.darkTheme) {
|
||||
document.documentElement.classList.add("dark");
|
||||
} else {
|
||||
document.documentElement.classList.remove("dark");
|
||||
}
|
||||
|
||||
document.documentElement.classList.toggle("dark", new_state.darkTheme);
|
||||
localStorage.setItem("settings", JSON.stringify(new_state));
|
||||
} catch (e) {
|
||||
console.log("An error occurred while trying to modify the local settings context state.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue