From a1cf1e89e79855d3788693a801ebc7db23290240 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 2 Mar 2023 14:37:09 +0100 Subject: [PATCH] :bug: (viewer) Fix client side action when in separate group --- .../features/chat/api/utils/executeGroup.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/viewer/src/features/chat/api/utils/executeGroup.ts b/apps/viewer/src/features/chat/api/utils/executeGroup.ts index 475743cb42..374f59d706 100644 --- a/apps/viewer/src/features/chat/api/utils/executeGroup.ts +++ b/apps/viewer/src/features/chat/api/utils/executeGroup.ts @@ -23,7 +23,11 @@ import { computePaymentInputRuntimeOptions } from '@/features/blocks/inputs/paym import { injectVariableValuesInButtonsInputBlock } from '@/features/blocks/inputs/buttons/api/utils/injectVariableValuesInButtonsInputBlock' export const executeGroup = - (state: SessionState, currentReply?: ChatReply) => + ( + state: SessionState, + currentReply?: ChatReply, + currentLastBubbleId?: string + ) => async ( group: Group ): Promise => { @@ -32,7 +36,7 @@ export const executeGroup = currentReply?.clientSideActions let logs: ChatReply['logs'] = currentReply?.logs let nextEdgeId = null - let lastBubbleBlockId: string | undefined + let lastBubbleBlockId: string | undefined = currentLastBubbleId let newSessionState = state @@ -97,11 +101,15 @@ export const executeGroup = return { messages, newSessionState, clientSideActions, logs } } - return executeGroup(newSessionState, { - messages, - clientSideActions, - logs, - })(nextGroup.group) + return executeGroup( + newSessionState, + { + messages, + clientSideActions, + logs, + }, + lastBubbleBlockId + )(nextGroup.group) } const computeRuntimeOptions =