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
FlatTermSelector: Invalidate optimistic update if term creation fails #59945
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @TMFHokies. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +7 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
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 works as described :)
Thanks for testing, @fabiankaegy! |
…WordPress#59945) Unlinked contributors: TMFHokies. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
What?
Fixes #39130.
PR fixes and improves error handling for the
FlatTermSelector
. This prevents optimistic update artifacts from being displayed if the creation of a new term fails.Why?
The
FlatTermSelector
uses an internal state to handle optimistic updates and provide better UX. The state should be invalidated when WP data selectors fetch new values, but the invalidation logic didn't account for term creation errors.P.S. The component had no error handling until #53369.
How?
Add a call to
onUpdateTerms
when there's an error during the term creation.Testing Instructions
Test snippet
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2024-03-18.at.12.53.30.mp4