diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js index 5ad9c390..f364bf68 100644 --- a/src/helpers/recal-helper.js +++ b/src/helpers/recal-helper.js @@ -78,5 +78,17 @@ export function anyPartWithRequiresRecalFlag(lineItems) { return false; } - return lineItems.some((li) => li.requiresRecalibration === true); + if (Array.isArray(lineItems)) { + return lineItems.some((li) => li.requiresRecalibration === true); + } + + const flattened = [ + ...(lineItems.glassParts ?? []), + ...(lineItems.supportingItems ?? []), + ...(lineItems.otherParts ?? []), + ...(lineItems.feeItems ?? []), + ...(lineItems.vaps ?? []), + ]; + + return flattened.some((li) => li.requiresRecalibration === true); }