weightless icon indicating copy to clipboard operation
weightless copied to clipboard

snackbar from template rendering issue

Open caliny97 opened this issue 5 years ago • 5 comments

Having a difficult time getting the snackbar from a template to work. Tried the code from the demo and a very simple template and it always rendered the same. Seems like the template content is not parsed.

image

caliny97 avatar Jun 17 '19 18:06 caliny97

I have had a similar issue. With me it was because i was using rollup and a different version of lit-html. Internally it uses instanceof a lit-html class and rollup renamed them to prevent clashes.

Just make sure yout lit-element/lit-html versions are the same as in weightless.

tionkje avatar Jun 17 '19 19:06 tionkje

I have had a similar issue. With me it was because i was using rollup and a different version of lit-html. Internally it uses instanceof a lit-html class and rollup renamed them to prevent clashes.

Just make sure yout lit-element/lit-html versions are the same as in weightless.

Made sure there is only one version of lit-element/lit-html being used but the issue still remains. My project doesn't use roll-up or webpack, it uses boiler code from PWA. Thanks

caliny97 avatar Jun 17 '19 22:06 caliny97

@andreasbm - any ideas about this issue? , I tried stepping thru but couldn't find the cause. Thanks

caliny97 avatar Jun 25 '19 19:06 caliny97

After digging more into this, i found the issue. The if/else condition "value instanceof TemplateResult" is skipped, event thought value is clearly an instance of TemplateResult and it just defaults to commit the value as is. I guess the issue lies at lit-html , my code is running as ES modules from polymer cli, not babel or rollup. Any ideas how to resolve this? Thanks

image

caliny97 avatar Jul 12 '19 18:07 caliny97

Finally resolved this. It turns out that weightless npm install includes its own version of lit-html, the if condition was skipped because the instance of TemplateResult was from the weightless copy of lit-html. For now i just deleted node_modules from node_modules/weightless. @andreasbm any reason for including a copy of lit-html? Thanks

caliny97 avatar Jul 21 '19 05:07 caliny97