[SSR] FAST elements with @lit-labs/ssr #2254
Replies: 1 comment 3 replies
-
Hi! Awesome to hear you're trying this out. For problem (1), it looks like that's happening because you're running lit-ssr's
This is all to say, we didn't envision that a different templating library would use lit-ssr's server |
Beta Was this translation helpful? Give feedback.
-
Hey! We've been playing with the @lit-labs/ssr package over in the FAST repo to see if we can get it working and wanted to share an update with ya'll and maybe get some thoughts/discussion on one of the issues we're running into.
I was able to get many templating features for a FAST element working using the
ElementRenderer
from@lit-labs/ssr
, but am running into a hurdle trying to bind IDL attributes to an element. In a nutshell, FAST's templating system works as follows:Binding
s to be evaluated for each element instance.Node
locations for later evaluation.DocumentFragment.innerHTML
assignment, and all bindings are then evaluated for the custom element instance.What this means is that there isn't an easy way to convert a FAST template with bindings to a yielded SSR string without using the real element to render. To render out the shadow DOM of the element then, we're creating the custom element in the
ElementRenderer
constructor and yielding theinnerHTML
of the element fromElementRenderer.renderShadow()
. This poses two related problems:@lit-labs/ssr
will find the yielded shadowed element (that was already created by the host during FAST element creation) and provide it toElementRenderer
for re-creation.innerHTML
string, so the redundant creation of these elements actually loses information during this process.I'm still investigating some workarounds involving element instance caching, but I thought I would get in touch and get your thoughts / see if there is something I'm missing from
@lit-labs/ssr
that might help address this.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions