2
0

🐛 (webhook) Fix getResultSample when linked typebot not found

Closes #364
This commit is contained in:
Baptiste Arnaud
2023-03-08 09:59:39 +01:00
parent 83ae81ccc6
commit 167d366d55

View File

@ -39,13 +39,16 @@ export const parseResultExample =
const extractLinkedInputBlocks =
(
typebot: Pick<Typebot | PublicTypebot, 'groups' | 'variables' | 'edges'>,
typebot:
| Pick<Typebot | PublicTypebot, 'groups' | 'variables' | 'edges'>
| undefined,
linkedTypebots: (Typebot | PublicTypebot)[]
) =>
async (
currentGroupId?: string,
direction: 'backward' | 'forward' = 'backward'
): Promise<InputBlock[]> => {
if (!typebot) return []
const previousLinkedTypebotBlocks = walkEdgesAndExtract(
'linkedBot',
direction,
@ -63,7 +66,7 @@ const extractLinkedInputBlocks =
'typebotId' in t
? t.typebotId === linkedBot.options.typebotId
: t.id === linkedBot.options.typebotId
) as Typebot | PublicTypebot,
),
linkedTypebots
)(linkedBot.options.groupId, 'forward')
)