popeindustries / lit-html-server

Render lit-html templates on the server as Node.js streams
MIT License
265 stars 12 forks source link

Repeat with undefined variable #120

Closed lukasoppermann closed 4 years ago

lukasoppermann commented 4 years ago

I get an error when I use the repeat directive with an empty / undefined variable. However this happens sometimes with templates when a certain value is undefined for some instances, but not for others. Is this supposed to not be handled by design?

Thank you for the clarification. Cheers Lukas

popeindustries commented 4 years ago

The items you send into the repeat directive needs to be an array, but the values can be undefined. This is the same behaviour as lit-html in the browser.

undefined values should otherwise work fine, but again, some directives may throw errors. Do you have a specific example of undefined causing errors (with stack trace) I could look at?

lukasoppermann commented 4 years ago

No, thanks, I actually had undefined without an array, I'll adjust the transformer to solve this, thanks.