Skip to content

Commit

Permalink
fix: "Unexpected token ';'" in expressions with trailing ';' (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatkashyap authored Feb 1, 2024
1 parent fcd66c0 commit 8f57693
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/toolpad-app/src/toolpad/AppEditor/BindingEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,11 @@ export function BindingEditorDialog<V>({
(input as JsExpressionAttrValue).$$jsExpression,
data!,
);
// Remove trailing spaces, newline characters for cleanliness and
// trailing semicolons since they introduce crashes while evaluation
const cleanedExpression = jsExpression.trim().replace(/;*$/, '');
newValue = {
$$jsExpression: jsExpression,
$$jsExpression: cleanedExpression,
};
}

Expand Down

0 comments on commit 8f57693

Please sign in to comment.