Describe the bug
When a Vue component is used as a slot of an SSR-ed Lit element, it cannot inject dependencies provided by the parent component using provide.
Here, <i-inject-some-depdencies /> is not able to actually inject the dependencies provided by <i-provide-some-dependencies />.
To Reproduce
Run the playground locally
Go to /with-provide-inject page
See that injected variable is not available during SSR and a hydration mismatch warning is logged in the browser console
Expected behavior
Provided dependencies should be injectable in children components used within a slot of an SSR-ed Lit element.
Screenshots
Nuxt version: 3.7.0
Browser: All
Additional context
This happens because the module renders a slot for a Lit element during SSR using renderToString. This leads to the loss of parent context. Better to use SSR primitives like ssrRenderVNode, ssrRenderAttrs, and ssrRender render hook.
Describe the bug When a Vue component is used as a slot of an SSR-ed Lit element, it cannot inject dependencies provided by the parent component using provide.
Here,
<i-inject-some-depdencies />
is not able to actually inject the dependencies provided by<i-provide-some-dependencies />
.To Reproduce
Expected behavior Provided dependencies should be injectable in children components used within a slot of an SSR-ed Lit element.
Screenshots
Additional context This happens because the module renders a slot for a Lit element during SSR using
renderToString
. This leads to the loss of parent context. Better to use SSR primitives likessrRenderVNode
,ssrRenderAttrs
, andssrRender
render hook.