Skip to content

Commit

Permalink
fix(mods): fix mod unsub for mods that don't have themes
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Mar 22, 2023
1 parent 923a609 commit 1ec1c2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/services/content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class ContentService {

const mod = storedMod.content;
const icons = storedMod.icons;
const themes = storedMod.themes;
const themes = storedMod.themes || [];

icons.forEach(icon => {
this.loadSVGFromString(icon.name, icon.data);
Expand Down Expand Up @@ -388,7 +388,7 @@ export class ContentService {
});

// unload themes
mod.themes?.forEach(theme => {
mod?.themes?.forEach(theme => {
const themeEl = document.getElementById(`theme-${theme.name}`);
themeEl?.remove();

Expand Down
3 changes: 0 additions & 3 deletions src/stores/mods/mods.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ export function cacheMod(ctx: StateContext<IGameMods>, { modId, modData }: Cache

export function uncacheMod(ctx: StateContext<IGameMods>, { modId }: UncacheMod) {
const mods = ctx.getState().mods || {};
const currentMod = mods[modId];
delete mods[modId];

const modThemes = currentMod.themes;
console.log('unload themes', modThemes);
ctx.patchState({ mods });
}

0 comments on commit 1ec1c2e

Please sign in to comment.