Skip to content
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(slotmixin): Now throws shadowRoot not found in case of shadowRoot… #2291

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stupid-hats-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lion/ui': patch
---

Now prints console error when shadowRoot is not found
7 changes: 6 additions & 1 deletion packages/ui/components/core/src/SlotMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@
if (isFirstRender) {
// @ts-expect-error wait for browser support
const supportsScopedRegistry = !!ShadowRoot.prototype.createElement;
const registryRoot = supportsScopedRegistry ? this.shadowRoot || document : document;
const hasShadowRoot = Boolean(this.shadowRoot);
if (!hasShadowRoot) {
// TODO: throw an error in a breaking release
console.error(`[SlotMixin] No shadowRoot was found`);

Check warning on line 137 in packages/ui/components/core/src/SlotMixin.js

View workflow job for this annotation

GitHub Actions / Verify changes

Unexpected console statement
tlouisse marked this conversation as resolved.
Show resolved Hide resolved
}
const registryRoot = supportsScopedRegistry ? this.shadowRoot : document;

// @ts-expect-error wait for browser support
const renderTargetThatRespectsShadowRootScoping = registryRoot.createElement('div');
Expand Down