Skip to content

Commit

Permalink
[TM-739] On initial creation, default to the first step.
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Jun 6, 2024
1 parent 40db9fe commit 78a2213
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const EditEntityPage = () => {
const { getReportingWindow } = useGetReportingWindow();
const entityName = router.query.entityName as EntityName;
const entityUUID = router.query.uuid as string;
const mode = router.query.mode as string; //edit, provide-feedback-entity, provide-feedback-change-request
const mode = router.query.mode as string | undefined; //edit, provide-feedback-entity, provide-feedback-change-request

const isReport = isEntityReport(entityName);
const { data: entityData } = useGetV2ENTITYUUID({
Expand Down Expand Up @@ -110,7 +110,8 @@ const EditEntityPage = () => {
const initialStepProps = useMemo(() => {
if (isLoading) return {};

const stepIndex = formSteps!.findIndex(step => step.fields.find(field => field.feedbackRequired) != null);
const stepIndex =
mode == null ? 0 : formSteps!.findIndex(step => step.fields.find(field => field.feedbackRequired) != null);

return {
initialStepIndex: stepIndex < 0 ? undefined : stepIndex,
Expand Down

0 comments on commit 78a2213

Please sign in to comment.