-
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
Fix updateSlot missing from default SlotFillContext #23108
Conversation
@@ -93,6 +93,7 @@ function useSlotRegistry() { | |||
slots, | |||
fills, | |||
registerSlot, | |||
updateSlot, |
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 was also missing from the React memo deps, although it wasn't making any difference.
Size Change: +10 B (0%) Total Size: 1.13 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.
Thanks for a quick fix 💯
As noted in the parent issue: #23014 (comment), we should consider adding warnings when the provider is missing.
Does this component work in expected ways without the provider? When reviewing the code, I got the impression that the Provider was absolutely necessary to get coherent behavior, and it would be preferable to throw an informative error early in the Consumer when it's not mounted under a Provider. |
@sirreal, see #23108 (review):
|
Closes #23014
Due to the convention that this module adopts, I think the preferred fix is to simply add
updateSlot
as a noop function to the default object that is returned by the context (whenSlotFillProvider
isn't present).But I also wonder when using
Slot
/Fill
withoutSlotFillProvider
would make sense.Failing test: https://travis-ci.com/github/WordPress/gutenberg/jobs/347817325#L3248