You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reading a slot by ID from inside another slot picks up that slot's children #364
The hooks that read a slot by its ID (useWidgetsForId, useWidgetOperations, useWidgetOptionsForId) all go through useSlotOperations(id). That function takes children and idAliases from the slot context, which is the context of whatever slot encloses the caller, and never checks that it's the slot being asked about.
In other words: when code inside slot A asks about slot B, slot A's children come back as slot B's defaultContent widget, and slot A's aliases are treated as slot B's.
Learning ran into this in openedx/frontend-app-learning#2267. Its sidebar provider has to decide which panel opens before the sidebar slots render, so it reads the panel slot from above it, much like the shell's own dropdown menu does. That read happens inside the courseware tab's slot. The slot has no children today, so nothing breaks, but a site that renders the courseware in a slot of its own, with children, would get a phantom widget in the sidebar's list. Learning filters defaultContent out by ID to be safe.
What I'd expect instead: the enclosing slot's children and aliases apply only when it's the slot being asked for. Read from outside, a slot has no default content, since that only exists where the slot is rendered.
Activity
fix: ignore the enclosing slot when reading another slot by id
openedx-semantic-release-bot commentedon Nov 26, 2026
🎉 This issue has been resolved in version 2.0.0-alpha.20 🎉
The release is available on:
Your semantic-release bot 📦🚀