-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Patterns: revert usePatternsState to return an array instead of object #54582
Conversation
Size Change: -25 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Flaky tests detected in b03ed42. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6230811167
|
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.
Thanks for the quick update here. I don't mind the object signature too but yeah prefers consistency whenever we can. If you feel that it should be an object, I'm ok if we update both hooks.
Let's just stick with the current approach this close to the beta 😃 |
What?
Reverts the change made in #53835 to return an object from usePatternsState to instead return an array
Why?
It was noted here that this change meant that it was now not consistent anymore with useBlocksState.
However the object makes for a nicer API than the array, ie. it avoids the likes of
const [ patterns, , onClickPattern ] =
, so up for debate as to whether this is the best approach.How?
Changed return value from object to array and updated all the places the hook is called.
Testing Instructions
Screenshots
patterns-performance-update.mp4