Skip to content

Commit

Permalink
Move where manager sets doorstop target
Browse files Browse the repository at this point in the history
Doorstop target was initially set in the mod list getter so the value
would get set in a new profile when BepInEx was installed. While this
works, it slows down the getter, which is called whenever the mod list
is updated, which happens quite often as user interacts with the local
mod list.

Instead, set the doorstop target when the modal showing the target is
opened. As far as I can tell, the doorstop is used here purely for
display reasons. The methods called are getters without side-effects,
and the GameRunner will call one or another when the game is launched
(choosing one based on whether the game is ran as modded or as
vanilla).
  • Loading branch information
anttimaki committed Jan 31, 2024
1 parent 488dc4a commit d2f0a1f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/pages/Manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,7 @@ import CategoryFilterModal from '../components/modals/CategoryFilterModal.vue';
return this.$store.state.thunderstoreModList || [];
}
get localModList() : ManifestV2[] {
if (this.contextProfile !== null) {
GameInstructions.getInstructionsForGame(this.activeGame, this.contextProfile!).then(async instructions => {
this.doorstopTarget = instructions.moddedParameters;
this.vanillaLaunchArgs = instructions.vanillaParameters;
});
GameRunnerProvider.instance.getGameArguments(this.activeGame, this.contextProfile!).then(target => {
if (target instanceof R2Error) {
this.doorstopTarget = "";
} else {
this.doorstopTarget = target;
}
});
}
get localModList(): ManifestV2[] {
return this.$store.state.localModList || [];
}
Expand Down Expand Up @@ -466,6 +453,21 @@ import CategoryFilterModal from '../components/modals/CategoryFilterModal.vue';
}
showLaunchParameters() {
if (this.contextProfile !== null) {
GameInstructions.getInstructionsForGame(this.activeGame, this.contextProfile).then(async instructions => {
this.doorstopTarget = instructions.moddedParameters;
this.vanillaLaunchArgs = instructions.vanillaParameters;
});
GameRunnerProvider.instance.getGameArguments(this.activeGame, this.contextProfile).then(target => {
if (target instanceof R2Error) {
this.doorstopTarget = "";
} else {
this.doorstopTarget = target;
}
});
}
this.launchParametersModel = this.settings.getContext().gameSpecific.launchParameters;
this.showLaunchParameterModal = true;
}
Expand Down

0 comments on commit d2f0a1f

Please sign in to comment.