[Expression] syntax errors are cleared on save
Create a watch expression with a syntax error, e.g. [1,2,3
Result: the expression is cleared and "Invalid expression..." is displayed.
Expected: the expression is not cleared so that you can fix the syntax error without having to rewrite it all.
@Loirooriol I believe this was added to the debugger in github. It should be in nightly tomorrow or monday.
Still bad after bug 1432842 (v10).
CC @bomsy @wldcordeiro what do you think?
I think it's a good idea that we do not clear the invalid expression. It can be quite frustrating to retype really long expressions because of tiny mistakes. Maybe making the border (and also maybe the text) red should be quite obvious to the user.
Maybe we shoould fix this as well here

The field should not remain red (in the invalid expression state) after the invalid expression has been field.
/claim
Thanks for claiming the issue! :wave:
!!! Please check your email and confirm the invitation
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
diff --git a/src/actions/expressions.js b/src/actions/expressions.js
index bf237e9..62fde2e 100644
--- a/src/actions/expressions.js
+++ b/src/actions/expressions.js
@@ -48,6 +48,7 @@ export function addExpression(input: string) {
}
export function clearExpressionError() {
+ // maybe this will help
return { type: "CLEAR_EXPRESSION_ERROR" };
}
diff --git a/src/components/SecondaryPanes/Expressions.js b/src/components/SecondaryPanes/Expressions.js
index fb22daf..dbd22d0 100644
--- a/src/components/SecondaryPanes/Expressions.js
+++ b/src/components/SecondaryPanes/Expressions.js
@@ -57,6 +57,7 @@ class Expressions extends Component<Props, State> {
}
clear = () => {
+ // some useful code
this.setState(() => {
this.props.clearExpressionError();
return { editing: false, editIndex: -1, inputValue: "" };
@@ -207,6 +208,8 @@ class Expressions extends Component<Props, State> {
renderExpressionEditInput(expression: Expression) {
const { expressionError } = this.props;
const { inputValue, editing } = this.state;
+
+ /// is this doing the right thing?
const error = editing === true && expressionError === true;
return (
<span className="expression-input-container" key={expression.input}>
Thank you, this will help a lot!