@ -153,7 +153,7 @@ const addLinkedTypebotToState = async (
|
|||||||
...linkedTypebot,
|
...linkedTypebot,
|
||||||
variables: fillVariablesWithExistingValues(
|
variables: fillVariablesWithExistingValues(
|
||||||
linkedTypebot.variables,
|
linkedTypebot.variables,
|
||||||
currentTypebotInQueue.typebot.variables
|
state.typebotsQueue
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
resultId: isPreview
|
resultId: isPreview
|
||||||
@ -204,13 +204,16 @@ const createResumeEdgeIfNecessary = (
|
|||||||
|
|
||||||
const fillVariablesWithExistingValues = (
|
const fillVariablesWithExistingValues = (
|
||||||
emptyVariables: Variable[],
|
emptyVariables: Variable[],
|
||||||
existingVariables: Variable[]
|
typebotsQueue: SessionState['typebotsQueue']
|
||||||
): Variable[] =>
|
): Variable[] =>
|
||||||
emptyVariables.map((emptyVariable) => {
|
emptyVariables.map((emptyVariable) => {
|
||||||
const matchedVariable = existingVariables.find(
|
let matchedVariable
|
||||||
(existingVariable) => existingVariable.name === emptyVariable.name
|
for (const typebotInQueue of typebotsQueue) {
|
||||||
)
|
matchedVariable = typebotInQueue.typebot.variables.find(
|
||||||
|
(v) => v.name === emptyVariable.name
|
||||||
|
)
|
||||||
|
if (matchedVariable) break
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...emptyVariable,
|
...emptyVariable,
|
||||||
value: matchedVariable?.value,
|
value: matchedVariable?.value,
|
||||||
|
Reference in New Issue
Block a user