Slot/Fill: Error when provider is missing #23388
Labels
Needs Dev
Ready for, and needs developer efforts
[Package] Components
/packages/components
[Type] Code Quality
Issues or PRs that relate to code quality
The design of Slot/Fill context hides problematic cases where a Consumer is not mounted under the necessary Provider.
It would be preferable to remove the stubbed context that hides misuse in applications. I'd like to see a descriptive error thrown immediately when the context is used without a provider:
gutenberg/packages/components/src/slot-fill/bubbles-virtually/slot-fill-context.js
Lines 1 to 16 in 6773860
An error in
useSlot
seems ideal:gutenberg/packages/components/src/slot-fill/bubbles-virtually/use-slot.js
Line 12 in 6773860
#23014 describes a bug where
SlotFillProvider
is not an ancestor of a SlotFillContext Consumer.#23108 fixes the error, but the caveats were noted in several places.
cc: @gziolo @youknowriad @diegohaz
The text was updated successfully, but these errors were encountered: