2
0

🐛 (typebotLink) Fix fetching when typebot ID is current bot ID

This commit is contained in:
Baptiste Arnaud
2022-12-12 09:41:35 +01:00
parent 3ab047a487
commit 54dee6e362

View File

@ -23,8 +23,11 @@ export const executeTypebotLink = async (
const linkedTypebot = (
block.options.typebotId === 'current'
? typebot
: [typebot, ...linkedTypebots].find(byId(block.options.typebotId)) ??
(await fetchAndInjectTypebot(block, context))
: [typebot, ...linkedTypebots].find((typebot) =>
'typebotId' in typebot
? typebot.typebotId === block.options.typebotId
: typebot.id === block.options.typebotId
) ?? (await fetchAndInjectTypebot(block, context))
) as PublicTypebot | LinkedTypebot | undefined
if (!linkedTypebot) {
onNewLog({