diff --git a/packages/utils/results.ts b/packages/utils/results.ts index 087b7c48553..d51d01f05db 100644 --- a/packages/utils/results.ts +++ b/packages/utils/results.ts @@ -186,17 +186,28 @@ const parseResultsFromPreviousBotVersions = ( ) && isNotEmpty(answer.content) ) - .map((answer) => ({ - id: answer.blockId, - label: `Deleted block`, - blocks: [ + .reduce((existingHeaders, answer) => { + if ( + existingHeaders.some( + (existingHeader) => existingHeader.id === answer.blockId + ) + ) + return existingHeaders + return [ + ...existingHeaders, { id: answer.blockId, - groupId: answer.groupId, + label: `${answer.blockId} (deleted block)`, + blocks: [ + { + id: answer.blockId, + groupId: answer.groupId, + }, + ], + blockType: InputBlockType.TEXT, }, - ], - blockType: InputBlockType.TEXT, - })) + ] + }, []) export const parseAnswers = (