-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: constraint validation affecting disabled button #4183
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
return hasValues || hasValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong. we were excluding locally invalid constraints from the remote check without saying those items are invalid
Array.isArray(constraint.values) && | ||
constraint.values.length > 0; | ||
const hasValue = Boolean(constraint.value); | ||
const invalidConstraints = constraints.find(item => !isValid(item)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check locally invalid constraints that don't require server checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we highlight what's wrong? it can be confusing when button is disabled and there is no validation error
Array.isArray(constraint.values) && | ||
constraint.values.length > 0; | ||
const hasValue = Boolean(constraint.value); | ||
const invalidConstraints = constraints.find(item => !isValid(item)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we highlight what's wrong? it can be confusing when button is disabled and there is no validation error
@Tymek previously we were not showing anything in this scenario. This is only when you add an empty constraint and try to submit it. When you try to save the constraint we have proper validation. |
About the changes
Fixing regression introduced by #3914.
We were not disabling save strategy or add to change request button on invalid constraints because we were filtering out invalid values locally in the frontend and excluding them from checking.
This PR fixes the regression and also introduces unit tests describing the new behavior.
Important files
Discussion points