Skip to content

Commit

Permalink
Move the wizard reset methods into one function
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 committed Aug 8, 2023
1 parent bfd1bd3 commit 680cf97
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,18 @@ export const AnalysisWizard: React.FC<IAnalysisWizard> = ({
};

const isModeValid = applications.every((app) => isModeSupported(app, mode));
const resetWizard = () => {
setCurrentTaskgroup(null);
reset();
onClose();
};

const onSubmit = (fieldValues: AnalysisWizardFormValues) => {
if (currentTaskgroup) {
const taskgroup = setupTaskgroup(currentTaskgroup, fieldValues);

submitTaskgroup(taskgroup);
}
setCurrentTaskgroup(null);
reset();
onClose();
resetWizard();
};

const onMove: WizardStepFunctionType = (
Expand All @@ -305,12 +307,10 @@ export const AnalysisWizard: React.FC<IAnalysisWizard> = ({
};

const handleClose = () => {
reset();
if (currentTaskgroup && currentTaskgroup.id) {
deleteTaskgroup(currentTaskgroup.id);
setCurrentTaskgroup(null);
}
onClose();
resetWizard();
};

const analyzableApplications = useAnalyzableApplications(applications, mode);
Expand Down

0 comments on commit 680cf97

Please sign in to comment.