-
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
SlotFill: some code cleanups of the bubblesVirtually version #50133
Conversation
Size Change: -33 B (0%) Total Size: 1.37 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.
The SlotFills "package" also has two hooks named useSlot
one is a public API and another used internally. It would be nice to rename latter and avoid confusion.
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.
The cleanup looks good IMHO 👍 Thanks!
I agree with @Mamaduka that the naming conflict can be confusing, but I'd say that the entire situation with the two "standard" and "bubbles virtually" versions is a bit awkward too. Ideally, we'd have a single version that we could just configure.
Optionally, this could have a CHANGELOG entry, but up to you really.
There are just two usages of I'm also wondering if we can somehow get rid of |
6494585
to
7818c26
Compare
Flaky tests detected in 7818c26. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4837403363
|
Well,
That being said, I'd rather keep the hook and benefit from the pre-existing performance optimizations. We could of course do some measurements. |
7818c26
to
9a7587a
Compare
Yes, I'd like to keep all performance benefits, I'm just thinking aloud about what we really need About |
The "Verify changelog update" CI check is still unhappy about the changelog. Tt's because I added an entry for two PRs at once, referencing both of them:
But the regexp in the check is more strict about parentheses, accepting only the |
Good point @jsnajdr, thanks for the ping. I see why it's confused and it'll be an easy enough fix. I'll get a PR together. |
After the successful #50098, here are some more code improvements in the
bubblesVirtually
version ofSlotFill
:registry
for the context, we can save manyuseRef
s anduseCallback
s by creating the registry as a constant object and then storing it, forever, in provider's state.useCallback
s inuseSlot
by creating the bound API object as a singleapi
object, withuseMemo
.Fill
to move hook call into a separate statement, as is the common custom.