-
Notifications
You must be signed in to change notification settings - Fork 126
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: Fix order of ShadowRootUI hooks calling #459
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
==========================================
- Coverage 85.45% 85.38% -0.08%
==========================================
Files 106 106
Lines 8067 8066 -1
Branches 783 783
==========================================
- Hits 6894 6887 -7
- Misses 1160 1166 +6
Partials 13 13 ☔ View full report in Codecov by Sentry. |
@ookkoouu What's your use case? For the shadow root, having the order flipped for |
Oh I see I said that... Hmm |
I wanted to mount the UI on multiple elements like a list. To know from ex: Mount the UI on a Youtube live chat icon with wrapper, want to get its username createShadowRootMultiUI(ctx, {
name: "wxt-inline",
position: "inline",
append: "last",
anchor: ".chat-icons",
onMount(container, shadowRoot, shadowHost) {
const userName = shadowHost
.closest(".chat-container")
?.querySelector(".chat-username")
?.textContent;
if (!userName) {
return;
}
const root = createRoot(container);
root.render(<App userName={userName} />);
return root;
},
}); Rendering artifacts is not so important IMO. |
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.
Ok, this should be fine.
Released in |
According to #333, it seems
onMount
should call after the UI is mounted, andonRemove
should call before the UI is removed, but ShadowRootUI was not.It's inconvenient that
shadowHost
is not connected when mounting UI.