From 5088b532b778ea514d786e6d0561708713a6038c Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 8 Jan 2025 18:07:54 +0100 Subject: [PATCH] fix: ensure area is correctly displayed when navigating back to DrawBoundary (#4119) --- .../src/@planx/components/DrawBoundary/Public/index.tsx | 3 ++- editor.planx.uk/src/@planx/components/DrawBoundary/model.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx index 62f5de38de..3eab48382d 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx @@ -57,8 +57,9 @@ export default function Component(props: Props) { props.previouslySubmittedData?.data?.[props.fn] || passport.data?.["property.boundary"]; const previousArea = - props.previouslySubmittedData?.data?.[props.fn] || + props.previouslySubmittedData?.data?.[`${props.fn}.area`] || passport.data?.["property.boundary.area"]; + const [boundary, setBoundary] = useState(previousBoundary); const [area, setArea] = useState(previousArea); const [mapValidationError, setMapValidationError] = useState(); diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/model.ts b/editor.planx.uk/src/@planx/components/DrawBoundary/model.ts index 69875aa276..6cd0b3927f 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/model.ts +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/model.ts @@ -28,7 +28,7 @@ export const parseDrawBoundary = ( data?.descriptionForUploading || defaultContent?.["descriptionForUploading"], hideFileUpload: data?.hideFileUpload || defaultContent?.["hideFileUpload"], - fn: data?.fn || defaultContent?.["fn"], + fn: defaultContent?.["fn"], // input is disabled, no need to account for data?.fn info: data?.info || defaultContent?.["info"], policyRef: data?.policyRef || defaultContent?.["policyRef"], howMeasured: data?.howMeasured || defaultContent?.["howMeasured"],