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

Lit SSR defer-hydration not being removed on subcomponent that do not have a node binding #3939

Closed
e111077 opened this issue Jun 7, 2023 · 2 comments · Fixed by #3942
Closed
Assignees

Comments

@e111077
Copy link
Member

e111077 commented Jun 7, 2023

Which package(s) are affected?

SSR (@lit-labs/ssr)

Description

When you SSR a component with a subcomponent in its shadowroot, lit-ssr will add defer-hydration to the element. The hydration step of Lit will then crawl the lit comment markers and remove that attribute on the component with a node marker.

Though, if there is no binding to a sub-component, and thus it does not have a node part marker, then lit hydration will never remove the defer-hydration attribute on the child.

Reproduction

live repro:
https://stackblitz.com/edit/node-jay1jm?file=index.html

useful commands in that repro are build to build the TS and gen-index to run lit-ssr to generate index.html

  • create two lit elements
  • place one of the elements in the shadow root of the other with no lit-bindings
  • import the definition of the child component in the module of the parent element
  • SSR the parent element onto a page
  • load the javascript bundle for the parent element (and transitively the child element)
  • See that defer-hydration has not been removed from the child element

Workaround

Place a dummy binding on the child element <my-second-element data-yolo=${swag}>

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

Failing in lit@2.7.5 and @lit-labs/ssr@3.1.3

Browser/OS/Node environment

tested on: node 16+ and Chrome 113

@augustjk
Copy link
Member

augustjk commented Jun 7, 2023

Looks like this might be regression from #3663
We should add back the lit-node marker for defined custom elements.

@e111077
Copy link
Member Author

e111077 commented Jun 13, 2023

🙏 🙏 🙏 🙏

e111077 added a commit to material-components/material-web that referenced this issue Jun 20, 2023
lit ssr update includes a fix for defer-hydration

lit/lit#3939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants