Skip to content

Commit

Permalink
Filter the mod list if a community targets a specific version of mod …
Browse files Browse the repository at this point in the history
…loader

Same BepInEx package can be listed in multiple communities. If a new
version is published for the package, we might want to target an older
version for some communities to avoid the chance of breaking things.

Thunderstore API returns all versions of the package. Filtering is done
on the list that is kept in memory by Vuex. In theory this approach
allows us to update the targeted version separately from reading the
whole mod list from the API and writing it to IndexedDB. It's not
necessarily what we end up doing, though.
  • Loading branch information
anttimaki committed Sep 11, 2024
1 parent f79b470 commit db49ab7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/store/modules/TsModsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ThunderstoreMod from '../../model/ThunderstoreMod';
import ConnectionProvider from '../../providers/generic/connection/ConnectionProvider';
import * as PackageDb from '../../r2mm/manager/PackageDexieStore';
import { Deprecations } from '../../utils/Deprecations';
import { filterModVersions } from '../../utils/ManagerUtils';

interface CachedMod {
tsMod: ThunderstoreMod | undefined;
Expand Down Expand Up @@ -163,6 +164,11 @@ export const TsModsModule = {

async updateMods({commit, rootState}) {
const modList = await PackageDb.getPackagesAsThunderstoreMods(rootState.activeGame.internalFolderName);

if (rootState.activeGameModLoaderTarget) {
filterModVersions(modList, rootState.activeGameModLoaderTarget);
}

const updated = await PackageDb.getLastPackageListUpdateTime(rootState.activeGame.internalFolderName);
commit('setMods', modList);
commit('setModsLastUpdated', updated);
Expand Down

0 comments on commit db49ab7

Please sign in to comment.