🐛 (setVariable) Fix transcription in loop

Closes #1774
This commit is contained in:
Baptiste Arnaud 2024-09-12 19:50:59 +02:00
parent 8a28c84415
commit c26ab77786
No known key found for this signature in database
2 changed files with 14 additions and 2 deletions

View File

@ -384,7 +384,12 @@ const parseTranscriptProps = async (
const parsePreviewTranscriptProps = async (
state: SessionState
): Promise<ParsedTranscriptProps | undefined> => {
if (!state.previewMetadata) return
if (!state.previewMetadata)
return {
answers: [],
setVariableHistory: [],
visitedEdges: [],
}
return {
answers: state.previewMetadata.answers ?? [],
setVariableHistory: state.previewMetadata.setVariableHistory ?? [],

View File

@ -131,7 +131,14 @@ const executeGroup = ({
for (const block of nextGroup?.group.blocks.slice(
nextGroup.blockIndex ?? 0
)) {
if (stopAtBlockId && block.id === stopAtBlockId) return currentTranscript
if (
stopAtBlockId &&
block.id === stopAtBlockId &&
answers.length === 0 &&
setVariableHistory.length === 0 &&
visitedEdges.length === 0
)
return currentTranscript
if (setVariableHistory.at(0)?.blockId === block.id)
typebotsQueue[0].typebot.variables = applySetVariable(
setVariableHistory.shift(),