From 0e8cfccc33d9046fe2fe4f49af66bc6fb35821be Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Wed, 8 Nov 2023 18:39:09 +0600 Subject: [PATCH] Initialize object before setting value (#6173) --- .../death/mutation/deceased-mappings.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/forms/register/mappings/event-specific-fields/death/mutation/deceased-mappings.ts b/packages/client/src/forms/register/mappings/event-specific-fields/death/mutation/deceased-mappings.ts index 2c5ca03f35..da596bbd8c 100644 --- a/packages/client/src/forms/register/mappings/event-specific-fields/death/mutation/deceased-mappings.ts +++ b/packages/client/src/forms/register/mappings/event-specific-fields/death/mutation/deceased-mappings.ts @@ -39,9 +39,9 @@ export const fieldToDeceasedDateTransformation = fieldValue = clonedTransformedData[sectionId][field.name] } - transformedData[ - alternativeSectionId ? alternativeSectionId : sectionId - ].deceased = { + transformedData[alternativeSectionId ?? sectionId] ??= {} + + transformedData[alternativeSectionId ?? sectionId].deceased = { deceased: true, deathDate: fieldValue }