-
-
Notifications
You must be signed in to change notification settings - Fork 24
feat: render devtools in a shadow node #181
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@tanstack/react-devtools': minor | ||
'@tanstack/devtools': minor | ||
--- | ||
|
||
Renders the devtools in a shadow DOM node |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,15 +157,10 @@ export const TanStackDevtools = ({ | |
}, | ||
render: (e, theme) => { | ||
const id = e.getAttribute('id')! | ||
const target = e.ownerDocument.getElementById(id) | ||
|
||
if (target) { | ||
setPluginContainers((prev) => ({ | ||
...prev, | ||
[id]: e, | ||
})) | ||
} | ||
|
||
setPluginContainers((prev) => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we are rendering the component in a shadow DOM node, I'm not certain I understand what this |
||
...prev, | ||
[id]: e, | ||
})) | ||
convertRender(plugin.render, setPluginComponents, e, theme) | ||
}, | ||
} | ||
|
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.
So "syncing" the styles from the parent page to the shadow DOM node is not what I initially set out to do. In fact, there were two approaches I made prior to this, but both failed.
Approach 1: Leverage goobers
css.bind({ target: <element> })
feature.useGoober
hook in the UI library, that provides the CSS bound target for the shadow nodeApproach 2: Just do Goobers
extractCSS