Skip to content

Commit

Permalink
Fix bug with active collections not persisting across sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
FLSoz committed Jun 6, 2022
1 parent 87cf106 commit edbdf90
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "terratech-steam-mod-loader",
"productName": "ttsm",
"description": "Mod loader for TerraTech that handles Steam Workshop mod configurations",
"version": "1.5.5",
"version": "1.5.6",
"scripts": {
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "terratech-steam-mod-loader",
"productName": "ttsm",
"description": "Mod loader for TerraTech that handles Steam Workshop mod configurations",
"version": "1.5.5",
"version": "1.5.6",
"main": "./dist/main/main.js",
"author": {
"name": "FLSoz",
Expand Down
26 changes: 25 additions & 1 deletion src/renderer/views/CollectionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,29 @@ class CollectionView extends Component<{ appState: AppState; location: Location
});
}

changeActiveCollection() {
const { updatePromiseManager: promiseManager } = this.state;
const { appState } = this.props;
const { config } = appState;

promiseManager
.execute(api.updateConfig(config as AppConfig))
.catch((error) => {
api.logger.error(error);
openNotification(
{
message: 'Failed to udpate config',
placement: 'bottomLeft',
duration: null
},
'error'
);
})
.finally(() => {
this.setState({});
});
}

pollGameRunning() {
const { updatePromiseManager: promiseManager } = this.state;
api.send(ValidChannel.GAME_RUNNING);
Expand Down Expand Up @@ -970,7 +993,8 @@ class CollectionView extends Component<{ appState: AppState; location: Location
}}
changeActiveCollectionCallback={(name: string) => {
appState.activeCollection = allCollections.get(name)!;
this.setState({});
config.activeCollection = name;
this.changeActiveCollection();
}}
numResults={filteredRows ? filteredRows.length : appState.mods.modIdToModDataMap.size}
newCollectionCallback={this.createNewCollection}
Expand Down

0 comments on commit edbdf90

Please sign in to comment.