From 5619eef459f4c67b3667b4f9ec6bc2e277febbf7 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 22 Nov 2022 08:14:25 +0100 Subject: [PATCH] :bug: (bot) Fix input prefill when linked to another typebot --- .../src/components/ChatGroup/ChatBlock/InputChatBlock.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/bot-engine/src/components/ChatGroup/ChatBlock/InputChatBlock.tsx b/packages/bot-engine/src/components/ChatGroup/ChatBlock/InputChatBlock.tsx index 737d772ea..292ba6ee1 100644 --- a/packages/bot-engine/src/components/ChatGroup/ChatBlock/InputChatBlock.tsx +++ b/packages/bot-engine/src/components/ChatGroup/ChatBlock/InputChatBlock.tsx @@ -41,8 +41,11 @@ export const InputChatBlock = ({ const { variableId } = block.options const defaultValue = - typebot.settings.general.isInputPrefillEnabled ?? true - ? variableId && typebot.variables.find(byId(variableId))?.value + (typebot.settings.general.isInputPrefillEnabled ?? true) && variableId + ? typebot.variables.find( + (variable) => + variable.name === typebot.variables.find(byId(variableId))?.name + )?.value : undefined const handleSubmit = async ({ label, value, itemId }: InputSubmitContent) => {