From c7e3a665116483e30d2a2a7800dcfa80a5779947 Mon Sep 17 00:00:00 2001 From: Rohit Date: Tue, 29 Apr 2025 20:49:24 +0530 Subject: [PATCH] feat: maxlen 0 if field not exist --- server/src/workflow-management/integrations/airtable.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/workflow-management/integrations/airtable.ts b/server/src/workflow-management/integrations/airtable.ts index a78ec72d..8113bc47 100644 --- a/server/src/workflow-management/integrations/airtable.ts +++ b/server/src/workflow-management/integrations/airtable.ts @@ -49,9 +49,12 @@ function mergeRelatedData(serializableOutput: SerializableOutput, binaryOutput: const mergedRecords: Record[] = []; const maxLength = Math.max( - ...(serializableOutput.scrapeSchema?.map(array => array?.length || 0) || [0]), - ...(serializableOutput.scrapeList?.map(array => array?.length || 0) || [0]), - ...(serializableOutput.other?.map(array => array?.length || 0) || [0]) + ...[ + ...(serializableOutput.scrapeSchema ?? []).map(arr => arr?.length ?? 0), + ...(serializableOutput.scrapeList ?? []).map(arr => arr?.length ?? 0), + ...(serializableOutput.other ?? []).map(arr => arr?.length ?? 0), + 0 + ] ); for (let i = 0; i < maxLength; i++) {