Skip to content

Commit

Permalink
Renaming the transition function to not be called as a callback
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Dec 12, 2023
1 parent e8ad6f1 commit 3524bd0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/AnacondaWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ const Footer = ({
}) => {
const [nextWaitsConfirmation, setNextWaitsConfirmation] = useState(false);
const [quitWaitsConfirmation, setQuitWaitsConfirmation] = useState(false);
const { activeStep, goToNextStep: onNext, goToPrevStep: onBack } = useWizardContext();
const { activeStep, goToNextStep, goToPrevStep } = useWizardContext();
const isBootIso = useContext(SystemTypeContext) === "BOOT_ISO";

const goToNextStep = (activeStep, onNext) => {
const onNext = (activeStep, goToNextStep) => {
// first reset validation state to default
setIsFormValid(true);

Expand All @@ -340,7 +340,7 @@ const Footer = ({
setStepNotification({ step: activeStep.id, ...ex });
},
onSuccess: () => {
onNext();
goToNextStep();

// Reset the state after the onNext call. Otherwise,
// React will try to render the current step again.
Expand All @@ -363,7 +363,7 @@ const Footer = ({
setStepNotification({ step: activeStep.id, ...ex });
},
onSuccess: () => {
onNext();
goToNextStep();

// Reset the state after the onNext call. Otherwise,
// React will try to render the current step again.
Expand All @@ -376,17 +376,17 @@ const Footer = ({
.then(cryptedPassword => {
const users = accountsToDbusUsers({ ...accounts, password: cryptedPassword });
setUsers(users);
onNext();
goToNextStep();
}, onCritFail({ context: N_("Password ecryption failed.") }));
} else {
onNext();
goToNextStep();
}
};

const goToPreviousStep = () => {
const onBack = () => {
// first reset validation state to default
setIsFormValid(false);
onBack();
goToPrevStep();
};

const currentStep = stepsOrder.find(s => s.id === activeStep.id);
Expand Down Expand Up @@ -417,7 +417,7 @@ const Footer = ({
id="installation-back-btn"
variant="secondary"
isDisabled={isFirstScreen || isFormDisabled}
onClick={() => goToPreviousStep()}>
onClick={() => onBack()}>
{_("Back")}
</Button>
<Button
Expand All @@ -428,7 +428,7 @@ const Footer = ({
isFormDisabled ||
nextWaitsConfirmation
}
onClick={() => goToNextStep(activeStep, onNext)}>
onClick={() => onNext(activeStep, goToNextStep)}>
{nextButtonText}
</Button>
<Button
Expand Down

0 comments on commit 3524bd0

Please sign in to comment.