Skip to content

Commit db49ab7

Browse files
committed
Filter the mod list if a community targets a specific version of mod 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.
1 parent f79b470 commit db49ab7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/store/modules/TsModsModule.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ThunderstoreMod from '../../model/ThunderstoreMod';
77
import ConnectionProvider from '../../providers/generic/connection/ConnectionProvider';
88
import * as PackageDb from '../../r2mm/manager/PackageDexieStore';
99
import { Deprecations } from '../../utils/Deprecations';
10+
import { filterModVersions } from '../../utils/ManagerUtils';
1011

1112
interface CachedMod {
1213
tsMod: ThunderstoreMod | undefined;
@@ -163,6 +164,11 @@ export const TsModsModule = {
163164

164165
async updateMods({commit, rootState}) {
165166
const modList = await PackageDb.getPackagesAsThunderstoreMods(rootState.activeGame.internalFolderName);
167+
168+
if (rootState.activeGameModLoaderTarget) {
169+
filterModVersions(modList, rootState.activeGameModLoaderTarget);
170+
}
171+
166172
const updated = await PackageDb.getLastPackageListUpdateTime(rootState.activeGame.internalFolderName);
167173
commit('setMods', modList);
168174
commit('setModsLastUpdated', updated);

0 commit comments

Comments
 (0)