Patterns: revert usePatternsState to return an array instead of object#54582
Merged
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
|
youknowriad
approved these changes
Sep 19, 2023
youknowriad
left a comment
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
Let's just stick with the current approach this close to the beta 😃 |
This file contains hidden or 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
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.
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