Skip to content

Commit

Permalink
🐛 Fix broken retake & stale wizard state
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 committed Oct 18, 2023
1 parent dfc524d commit 130f2a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions client/src/app/pages/assessment/assessment-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const AssessmentPage: React.FC = () => {
<AssessmentWizard
assessment={assessment}
isLoadingAssessment={isFetching}
fetchError={fetchError}
/>
</PageSection>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,6 @@ const DynamicAssessmentActionsRow: FunctionComponent<
}).then(() => {
createAssessment();
});
history.push(
formatPath(
isArchetype
? Paths.archetypesAssessment
: Paths.applicationsAssessment,
{
assessmentId: assessment?.id,
}
)
);
} catch (error) {
pushNotification({
title: t("terms.error"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { FieldErrors, FormProvider, useForm } from "react-hook-form";
import {
Alert,
ButtonVariant,
Spinner,
Wizard,
Expand Down Expand Up @@ -42,6 +43,7 @@ import useIsArchetype from "@app/hooks/useIsArchetype";
import { useFetchStakeholderGroups } from "@app/queries/stakeholdergoups";
import { useFetchStakeholders } from "@app/queries/stakeholders";
import { WizardStepNavDescription } from "../wizard-step-nav-description";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";

export const SAVE_ACTION_KEY = "saveAction";

Expand All @@ -66,11 +68,13 @@ export interface AssessmentWizardValues {
export interface AssessmentWizardProps {
assessment?: Assessment;
isLoadingAssessment: boolean;
fetchError?: AxiosError | null;
}

export const AssessmentWizard: React.FC<AssessmentWizardProps> = ({
assessment,
isLoadingAssessment,
fetchError,
}) => {
const isArchetype = useIsArchetype();
const queryClient = useQueryClient();
Expand Down Expand Up @@ -586,6 +590,14 @@ export const AssessmentWizard: React.FC<AssessmentWizardProps> = ({

return (
<>
{fetchError && (
<Alert
className={`${spacing.mtMd} ${spacing.mbMd}`}
variant="danger"
isInline
title={getAxiosErrorMessage(fetchError)}
/>
)}
{isLoadingAssessment ? (
<Spinner />
) : (
Expand Down

0 comments on commit 130f2a3

Please sign in to comment.