Skip to content

Commit

Permalink
6370: blank finish screen during mod activation if missing keyboard s…
Browse files Browse the repository at this point in the history
…hortcut and no other config options (#6371)

* auto activate recipe when there are no mod options

* skip auto activation on reactivation only if the mod has optional configurations
  • Loading branch information
grahamlangford authored Sep 8, 2023
1 parent 219fe90 commit e237877
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/sidebar/activateRecipe/ActivateModPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ const ActivateRecipePanelContent: React.FC<
initialState
);

const optionsWizardStep = useMemo(
() => wizardSteps.find(({ key }) => key === "options"),
[wizardSteps]
);

async function handleActivationDecision() {
reduxDispatch(actions.hideModActivationPanel());
}
Expand Down Expand Up @@ -287,15 +292,14 @@ const ActivateRecipePanelContent: React.FC<
}, []);

// Trigger auto-activation if the recipe does not require permissions or user configuration, and there's no error.
// Additionally, always show the options if this is a reactivation. (Reactivation, in practice, is used to
// reconfigure mod options)
// Skip auto-activation on reactivation only if the mod has optional configurations.
useEffect(() => {
if (
state.needsPermissions != null &&
!state.needsPermissions &&
!requiresConfiguration &&
!state.activationError &&
!isActive
(!optionsWizardStep || !isActive)
) {
// State is checked inside activateRecipe to prevent double-activation
void activateRecipe();
Expand All @@ -306,6 +310,7 @@ const ActivateRecipePanelContent: React.FC<
requiresConfiguration,
state.needsPermissions,
state.activationError,
optionsWizardStep,
isActive,
]);

Expand Down Expand Up @@ -334,7 +339,7 @@ const ActivateRecipePanelContent: React.FC<
<div className={styles.root}>
<ActivateModInputs
recipe={modDefinition}
optionsWizardStep={wizardSteps.find(({ key }) => key === "options")}
optionsWizardStep={optionsWizardStep}
initialValues={initialValues}
onChange={onChange}
validationSchema={validationSchema}
Expand Down

0 comments on commit e237877

Please sign in to comment.