-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[labs/ssr] Cannot SSR a dynamic tag with unsafeStatic #2246
Copy link
Copy link
Closed
Description
https://gist.github.com/shakyShane/423b19e9f479b06369eb90f4f503310a
The following stand-alone code examples both cause the error Error: unexpected final partIndex: 0 !== 1.
I'm using unsafeStatic in a controlled way (eg: not user-provided data).
import "@lit-labs/ssr/lib/render-with-global-dom-shim.js";
import { render as renderDomShim } from "@lit-labs/ssr/lib/render-with-global-dom-shim.js";
import { html, unsafeStatic } from 'lit/static-html.js'
import { LitElement } from 'lit'
/**
* Rendering a static `<p>` fails
*
* ```
* Error: unexpected final partIndex: 0 !== 1
* ```
*/
const staticP = unsafeStatic('p');
for (const part of renderDomShim(html`<${staticP}>hello</${staticP}>`)) {
console.log(part);
}
/**
* Rendering a custom element also fails
*/
customElements.define('any-thing', class extends LitElement {
render() {
return html`<p>Hello world</p>`
}
})
const element = unsafeStatic('any-thing');
for (const part of renderDomShim(html`<${element}>hello</${element}>`)) {
console.log(part);
}Any help will be greatly appreciated :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done