literalpie / storybook-framework-qwik

Add Qwik support to storybook
28 stars 6 forks source link

useVisibleTask$ not working #65

Closed O-Hooman closed 11 months ago

O-Hooman commented 1 year ago

I noticed something, it seems useVisibleTask$ not working (the code inside is not executed) but useTask$ is working, I wonder if this is because it's inside the iframe, or no SSR, or no serialization happens, or there's something wrong with my code

Simple example:

useVisibleTask$(() => {
    console.log('ok')
})
O-Hooman commented 1 year ago

Notes: tried on qwik@1.1.5 and it's working but not @1.2.8

literalpie commented 1 year ago

Oof, I'm really stumped about this one. I confirmed that the qwik loader is still being added correctly, and I don't see any difference in the code that gets added to storybook between the two versions.

As said above, 1.1.5 works as expected. I also tested 1.2.0 and that does not work, so there must be something in that minor version release.

There was a time in the past where Qwik had an issue similar to this. However, unlike that time, vite --mode dev works as expected here. I don't know what could be different between a dev mode build and storybook - they both just use the qwik render function.

O-Hooman commented 1 year ago

Oof, I'm really stumped about this one. I confirmed that the qwik loader is still being added correctly, and I don't see any difference in the code that gets added to storybook between the two versions.

As said above, 1.1.5 works as expected. I also tested 1.2.0 and that does not work, so there must be something in that minor version release.

There was a time in the past where Qwik had an issue similar to this. However, unlike that time, vite --mode dev works as expected here. I don't know what could be different between a dev mode build and storybook - they both just use the qwik render function.

Yeah kind of weird, I'll try to find a workaround and report it to qwik as an issue maybe the problem is from the qwik itself

Comedalte commented 11 months ago

I got this working by having the render parent being part of the dom before I run it. In other words, it should work after moving down this line until after the parent container is appended to the dom (line 24).