Skip to content

Commit

Permalink
[snazzy-shelter] fix store not getting updated
Browse files Browse the repository at this point in the history
repro: enable a theme, disable it, reload discord -> theme is still enabled
  • Loading branch information
ioj4 authored and yellowsink committed Aug 8, 2024
1 parent e587ea1 commit 96a38c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/snazzy-shelter/src/util/themeLoadUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export async function loadTheme(theme) {
delete toPush.CSS;
toPush.enabled = true;

if (themeCacheIndex === -1) store.themes = [...store.themes, toPush];
if (themeCacheIndex === -1) store.themes.push(toPush);
else store.themes[themeCacheIndex] = toPush;

// trigger set event
//store.themes = store.themes;
store.themes = store.themes;
}

export function unloadTheme(theme) {
Expand All @@ -38,11 +38,11 @@ export function unloadTheme(theme) {
const themeCacheIndex = store.themes.findIndex((t) => t.url === theme.url);
let toPush = { ...theme };
toPush.enabled = false;
if (themeCacheIndex === -1) store.themes = [...store.themes, toPush];
if (themeCacheIndex === -1) store.themes.push(toPush);
else store.themes[themeCacheIndex] = toPush;

// trigger set event
// store.themes = store.themes;
store.themes = store.themes;
}

export function removeTheme(theme) {
Expand Down

0 comments on commit 96a38c6

Please sign in to comment.