Skip to content

Commit

Permalink
fixed UpdateSet reverting collection load order import
Browse files Browse the repository at this point in the history
  • Loading branch information
IDCs committed Dec 19, 2024
1 parent 7c4765b commit 352952b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/extensions/file_based_loadorder/collections/loadOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { findGameEntry } from '../gameSupport';
import { genCollectionLoadOrder } from '../util';

import LoadOrderCollections from '../views/LoadOrderCollections';
import UpdateSet from '../UpdateSet';

export async function generate(api: types.IExtensionApi,
state: types.IState,
Expand Down Expand Up @@ -49,14 +50,16 @@ export async function generate(api: types.IExtensionApi,

export async function parser(api: types.IExtensionApi,
gameId: string,
collection: ICollection): Promise<void> {
collection: ICollection,
updateSet: UpdateSet): Promise<void> {
const state = api.getState();

const profileId = selectors.lastActiveProfileForGame(state, gameId);
if (profileId === undefined) {
return Promise.reject(new CollectionParseError(collection, 'Invalid profile id'));
}

updateSet.init(gameId, (collection.loadOrder ?? []).map((lo, index) => ({ ...lo, index })));
api.store.dispatch(setFBLoadOrder(profileId, collection.loadOrder));
return Promise.resolve(undefined);
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/file_based_loadorder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export default function init(context: IExtensionContext) {
util.getSafe(state, ['persistent', 'mods', gameId], {});
return generate(context.api, state, gameId, stagingPath, includedMods, mods);
},
(gameId: string, collection: ICollection) => parser(context.api, gameId, collection),
(gameId: string, collection: ICollection) => parser(context.api, gameId, collection, updateSet),
() => Promise.resolve(),
(t) => t('Load Order'),
(state: types.IState, gameId: string) => {
Expand Down

0 comments on commit 352952b

Please sign in to comment.