-
Notifications
You must be signed in to change notification settings - Fork 926
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
[labs/ssr] LitElement renders content inside a Declarative Shadow DOM when using createRenderRoot
server side
#3080
Comments
createRenderRoot
server sidecreateRenderRoot
server side
createRenderRoot
server sidecreateRenderRoot
server side
I'm not sure we're going to be able to support customized render roots like this, so we'll have to add a check and throw an error. |
So it would just fail entirely? So effectively there would be no way to SSR a LitElement without having to use Declarative Shadow DOM? |
For now, it's likely. The problem here is that lit-html's hydration relies on shadow roots for nested hydration - that is lit-html's Setting the render root to We could probably add support for this in time, but until then it seems wiser to error than to incorrectly put what should have been light-DOM into the shadow root. |
Alrighty. Good to know and thanks for the explanation. |
Some password managers (LastPass being the largest) still do not discover input elements in ShadowDOM. Since my main application requires authentication, SSR for the login form is the largest need making the requirement for ShadowDOM only a blocker for me. It's more important that password manager integration function than implementing SSR. Is there a path forward here for this special case? If that means I have to write custom hydration logic for these specific cases that is completely acceptable. Said another way - I don't expect this to be a common requirement for most developers and the solution can be technically difficult for me to implement. |
@ChadKillingsworth talking with more SSR users recently makes me think we'll need to support this - it's just a question of when we can get to it. Technically what we need to do is leave an indicator on the root child part that tells any outer hydration pass to just skip it completely - it doesn't even count as a part as far the outer template is concerned. This seems like good practice anyway for all render roots. It'll allow mixing of imperatively created render roots. Then we'll need to make sure that LitElement's hydration can pick up the right child part when the render root is customized. cc @kevinpschaaf and @augustjk |
That makes sense and I agree on the priority as well. Thanks! |
This would greatly help our team out, too, as we're considering lit SSR + light DOM only for our new architecture. Is there any way to use any of the shadyDOM JS related code to convert a render to shady DOM? So if we could convert something like this: collectResultSync(render(html`<item-tile mdapi="..."><item-stat>...</item-stat></item-tile>`))) to shady DOM on the server and send that out to the client, we'd get the setup
(Seems worth mentioning we've got SPA and |
Support for this will be very useful for us too 👍 |
We would also be very happy with this issue being fixed. The biggest, if not only, issue keeping us from using Lit SSR at the moment. Keep up the amazing work. |
Hi there! May I ask if there is any update on this? |
Just wanted to circle back on this again, now in light of support for server only templates ( #2441 ), that being able to have server only components (without DSD) would be a great companion feature! A similar thread around doing |
Any updates? |
Description
When using Lit SSR and enabling
createRenderRoot
for a custom element, Lit is rendering the content inside declarative shadow DOM<template>
tag.Steps to Reproduce
createRenderRoot
Live Reproduction Link
https://stackblitz.com/github/thescientist13/lit-ssr-create-render-root
Expected Results
No Declarative Shadow DOM would be present, just like in the Lit Playground
Actual Results
Declarative Shadow DOM is still rendered
Browsers Affected
The text was updated successfully, but these errors were encountered: