Open herrKlein opened 11 months ago
Hi , I check the issue this is happening because of bug in lit librrary thats why it called twice
Did you find a reference to a bug report in lit. or do you know what causes this to happen in storybook but not in the playground?
I also have this issue, two VM scripts are made in Chrome when I inject a console log. I am doing this through a storybook decorator.
The constructor in lit web-component, wen used in storybook is called twice.
test-constructor.ts
count is
2
in storybook ( reproducible example below ) count is1
in lit-playground ( reproducible example below )test-constructor.stories.ts
This gives a number of problems, including a warning the reactive cycle is called within. And some implemented lifecycle methods. I think this is related: https://github.com/storybookjs/storybook/issues/17094. But a very old issue and maybe that one was related to lit itself.
There are no workarounds known te me, so hopefully someone knows what the problem is when using lit in storybook.
Thanks in advance
To Reproduce
The following component in Storybook calls the constructor twice
https://stackblitz.com/edit/github-q3itzv?file=src%2Fstories%2Ftest-constructor.stories.ts,src%2Fstories%2Ftest-constructor.ts&preset=node
The same component in Lit Playground only calls the constructor once
Lit playground reproduce
System
Additional context
No response