diff --git a/src/components/navigation/NavigationMenu.vue b/src/components/navigation/NavigationMenu.vue index 9a2ae473d..bcea0af9b 100644 --- a/src/components/navigation/NavigationMenu.vue +++ b/src/components/navigation/NavigationMenu.vue @@ -67,7 +67,6 @@ import R2Error from '../../model/errors/R2Error'; import Game from '../../model/game/Game'; import GameManager from '../../model/game/GameManager'; import Profile from '../../model/Profile'; -import ThunderstoreMod from '../../model/ThunderstoreMod'; import { LaunchMode, launch, @@ -83,11 +82,9 @@ export default class NavigationMenu extends Vue { private LaunchMode = LaunchMode; get thunderstoreModCount() { - let mods: ThunderstoreMod[] = this.$store.state.tsMods.mods; - return this.$store.state.modFilters.showDeprecatedPackages - ? mods.length - : mods.filter((m) => !m.isDeprecated()).length; + ? this.$store.state.tsMods.mods.length + : this.$store.getters['tsMods/undeprecatedModCount']; } get localModCount(): number { diff --git a/src/components/views/LocalModList/LocalModCard.vue b/src/components/views/LocalModList/LocalModCard.vue index 24a199e90..50673cb89 100644 --- a/src/components/views/LocalModList/LocalModCard.vue +++ b/src/components/views/LocalModList/LocalModCard.vue @@ -37,7 +37,7 @@ export default class LocalModCard extends Vue { } get isDeprecated() { - return this.tsMod ? this.tsMod.isDeprecated() : false; + return this.$store.state.tsMods.deprecated.get(this.mod.getName()) || false; } get isLatestVersion() { diff --git a/src/components/views/OnlineModView.vue b/src/components/views/OnlineModView.vue index d84b9531d..c74a3b8b6 100644 --- a/src/components/views/OnlineModView.vue +++ b/src/components/views/OnlineModView.vue @@ -155,7 +155,9 @@ export default class OnlineModView extends Vue { this.searchableThunderstoreModList = this.searchableThunderstoreModList.filter(mod => !mod.getNsfwFlag()); } if (!showDeprecatedPackages) { - this.searchableThunderstoreModList = this.searchableThunderstoreModList.filter(mod => !mod.isDeprecated()); + this.searchableThunderstoreModList = this.searchableThunderstoreModList.filter( + mod => !this.$store.state.tsMods.deprecated.get(mod.getFullName()) + ); } if (filterCategories.length > 0) { this.searchableThunderstoreModList = this.searchableThunderstoreModList.filter((x: ThunderstoreMod) => { diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 1be513677..d44ff4e4c 100644 --- a/src/store/modules/TsModsModule.ts +++ b/src/store/modules/TsModsModule.ts @@ -95,6 +95,10 @@ export const TsModsModule = { /*** Return ThunderstoreMod representation of a ManifestV2 */ tsMod: (_state, getters) => (mod: ManifestV2): ThunderstoreMod | undefined => { return getters.cachedMod(mod).tsMod; + }, + + undeprecatedModCount(state) { + return [...state.deprecated].filter(([_, isDeprecated]) => !isDeprecated).length; } },