-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
base: main
Are you sure you want to change the base?
Conversation
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 |
cypress/utils/steps.js
Outdated
.next() | ||
.first() // Вибрати перший елемент після parents() |
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.
please remove the comments
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.
Fixed
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