From c1ae35564dca690a84122b1b52ab4a94dffda896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Sun, 19 Nov 2023 13:02:20 +0000 Subject: [PATCH] fix: SummaryList bug --- .../@planx/components/shared/Preview/SummaryList.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx index 984f5524ae..9f4890fb77 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -113,21 +113,17 @@ function SummaryListsBySections(props: SummaryListsBySectionsProps) { const isValidComponent = ([nodeId, userData]: BreadcrumbEntry) => { const node = props.flow[nodeId]; - const Component = node.type && presentationalComponents[node.type]; + const doesNodeExist = Boolean(props.flow[nodeId]); + if (!doesNodeExist) return false; + const Component = node.type && presentationalComponents[node.type]; const isPresentationalComponent = Boolean(Component); - const doesNodeExist = Boolean(props.flow[nodeId]); const isAutoAnswered = userData.auto; const isInfoOnlyMode = node.type === TYPES.FileUploadAndLabel && props.flow[nodeId].data?.hideDropZone; - return ( - doesNodeExist && - !isAutoAnswered && - isPresentationalComponent && - !isInfoOnlyMode - ); + return !isAutoAnswered && isPresentationalComponent && !isInfoOnlyMode; }; const removeNonPresentationalNodes = (