-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: clear field error in Editor after the field value is changed #7216
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I noticed the fields were jumping when there is a field error. Just added a common 2024-05-28.22.37.33.mov |
@olegfedak is this PR still a work in progress? |
Well, it's ready but strugled on the tests |
martinjagodic
requested changes
Aug 21, 2024
martinjagodic
approved these changes
Aug 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
There is a situation when several fields are highlighted as "required" at the same time. It looks like red frames inside of red frames when it comes to nested widgets. When you make changes to these fields, the errors do not disappear. It's confusing because it's not clear how many fields are left, especially when the page needs to be scrolled.
I expect that when the user changes the value of the field, the error disappears, no need to "signal" with red.
Changes that allow to achieve that
Modified the
clearFieldErrors
action:Created an action
clearFieldErrors
in theentries.js
file that acceptsuniqueFieldId
as a parameter and returns an action object with typeDRAFT_CLEAR_ERRORS
and the passeduniqueFieldId
.Added
DRAFT_CLEAR_ERRORS
handling in the reducer:In the
entryDraftReducer
, added handling for theDRAFT_CLEAR_ERRORS
action, which removes errors for a specific field usinguniqueFieldId
.Updated the
EditorControl
component:In the
EditorControl
component, invokedclearFieldErrors
when the field value changes, passinguniqueFieldId
as an argument. This was done through props, using themapDispatchToProps
function that wrapsclearFieldErrors
indispatch
.Ensured proper action
dispatch
in onChange:Added a call to
clearFieldErrors
in theonChange
function to clear errors only for the specific field, using the passeduniqueFieldId
.By doing this, we ensured that errors are cleared only for the specific field when its value changes.
How it looks
2024-05-28.06.44.27-3.mp4