From 78a22133a707ea40fa4b1d7a71b0b64fa9039fcd Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Wed, 5 Jun 2024 20:26:43 -0700 Subject: [PATCH] [TM-739] On initial creation, default to the first step. --- src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx b/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx index f50619081..9e4f313c8 100644 --- a/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx +++ b/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx @@ -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({ @@ -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,