Skip to content

Commit

Permalink
workshop collections are no longer memoized (#21)
Browse files Browse the repository at this point in the history
- Fixes invalid data being exported as part of a
  collection.
- Editing collections will unfortunately be slower
  as a result, but we can't allow for invalid metadata
  to be exported as part of a collection.

part of #15703
  • Loading branch information
IDCs authored May 16, 2024
1 parent 252e69b commit 4f4fef4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "collections",
"description": "Allows creation of installation of mod packs (meta mods that install a bunch of other mods)",
"version": "0.1.5",
"version": "0.1.6",
"main": "./out/index.js",
"license": "GPL-3.0",
"author": "Black Tree Gaming Ltd.",
Expand Down
5 changes: 2 additions & 3 deletions src/collectionCreate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import memoizeOne from 'memoize-one';
import { MOD_TYPE } from './constants';
import { createCollectionFromProfile } from './util/transformCollection';

Expand Down Expand Up @@ -32,13 +31,13 @@ export async function initFromProfile(api: types.IExtensionApi, profileId: strin
}
}

const collections = memoizeOne((mods: { [modId: string]: types.IMod }) => {
const collections = (mods: { [modId: string]: types.IMod }) => {
const isWorkshopCollection = mod => (mod.type === MOD_TYPE)
&& (mod.attributes?.editable === true);
return Object.values(mods)
.filter(isWorkshopCollection)
.map(coll => new Set((coll.rules ?? []).map(rule => rule.reference.id)));
});
};

export function addCollectionCondition(api: types.IExtensionApi, instanceIds: string[]) {
const state = api.getState();
Expand Down
2 changes: 0 additions & 2 deletions src/util/InstallDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import InfoCache from './InfoCache';
import { calculateCollectionSize, getUnfulfilledNotificationId, isRelevant, modRuleId, walkPath } from './util';

import * as _ from 'lodash';
import turbowalk, { IEntry } from 'turbowalk';
import { IFileListItem, IModReference } from 'vortex-api/lib/extensions/mod_management/types/IMod';

export type Step = 'prepare' | 'changelog' | 'query' | 'start' | 'disclaimer' | 'installing' | 'recommendations' | 'review';

Expand Down

0 comments on commit 4f4fef4

Please sign in to comment.