-
Notifications
You must be signed in to change notification settings - Fork 4.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
Data: Improve hasResolvingSelectors
redux metadata selector
#50865
Conversation
Size Change: -4 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7cc91b6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5055444848
|
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.
I'm optimistically marking this as green, but I flagged a thing in the review. :)
Thanks for addressing my feedback!
* This uses the internal `_map` property of `EquivalentKeyMap` for | ||
* optimization purposes, since the `EquivalentKeyMap` implementation | ||
* does not support a `.some()` implementation. |
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 uses the internal `_map` property of `EquivalentKeyMap` for | |
* optimization purposes, since the `EquivalentKeyMap` implementation | |
* does not support a `.some()` implementation. | |
* This uses the internal `_map` property of `EquivalentKeyMap` for | |
* optimization purposes, since the `EquivalentKeyMap` implementation | |
* does not support a `.values()` implementation. |
Unless I misunderstood, I believe you have a typo here. By analogy with the standard Map
, we expect the prototype to contain values()
but not some()
(besides, what would this some()
iterate over? Just the values? Keys? Keys and values?).
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.
Oh well, .some()
is what we intend to use here and it is what we actually use from Array.prototype
once we convert the map to an array. We could rephrase this to use .values()
or .entries()
but I think since .some()
is what we are practicaly using, it makes most sense to mention that in the documentation. We could mention .values()
but it wouldn't immediately be clear as to where we'd need .values()
since we never call Map.prototype.values()
. Does this make sense?
I think you're right, will update. We do need only the values anyway.
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.
Hmm, I actually think I misunderstood you. Let me correct this.
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.
Updated. Thanks for the feedback!
What?
This PR adds a couple of improvements to the
hasResolvingSelectors
selector to address the feedback provided in #50222 (comment).Why?
To address some feedback and use the opportunity to improve and better document the selector.
How?
We're essentially doing a couple of improvements:
Object.values()
already returns an array and cloning is unnecessary since there's no way to mutate it.EquivalentKeyMap
property usage.Testing Instructions
Testing Instructions for Keyboard
None
Screenshots or screencast
None