From 6339f442bf1ef693d87059e4181f09a02716038e Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 22 Feb 2023 12:21:11 +0100 Subject: [PATCH] :bug: (setVariable) Avoid evaluate code if single variable --- .../blocks/logic/setVariable/api/utils/executeSetVariable.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/viewer/src/features/blocks/logic/setVariable/api/utils/executeSetVariable.ts b/apps/viewer/src/features/blocks/logic/setVariable/api/utils/executeSetVariable.ts index 3aa3dfe59..ba07f257b 100644 --- a/apps/viewer/src/features/blocks/logic/setVariable/api/utils/executeSetVariable.ts +++ b/apps/viewer/src/features/blocks/logic/setVariable/api/utils/executeSetVariable.ts @@ -37,6 +37,9 @@ export const executeSetVariable = async ( const evaluateSetVariableExpression = (variables: Variable[]) => (str: string): unknown => { + const isSingleVariable = + str.startsWith('{{') && str.endsWith('}}') && str.split('{{').length === 2 + if (isSingleVariable) return parseVariables(variables)(str) const evaluating = parseVariables(variables, { fieldToParse: 'id' })( str.includes('return ') ? str : `return ${str}` )