-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[Mobile] - BottomSheetSelectControl - Add empty fallback option #60333
Conversation
…selected option couldn't be found
Size Change: 0 B Total Size: 1.73 MB ℹ️ View Unchanged
|
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 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. |
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.
Thank you @geriux! 🙇
…Press#60333) * Mobile - BottomSheetSelectControl - Add empty fallback option if the selected option couldn't be found * Update Changelog
Related PRs:
What?
This PR adds an empty option fallback if the selected value can't be found in the
items
array.Why?
There might be cases where the selected item is no longer present in the options due to cache or settings changing from the server. If the selected option is not present
selectedOption
returnsundefined
causing this component to crash when trying to access thelabel
value.How?
By adding an empty state
EMPTY_OPTION
as a fallback whenselectedOption
is undefined.Testing Instructions
Smoke test this component works as expected in the following cases:
Buttons block
Image block
ImageSizeOptions.mov