QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.67k stars 1.29k forks source link

[🐞] Signals don't trigger rerender with some problematic JSX markup #5782

Open EatChangmyeong opened 7 months ago

EatChangmyeong commented 7 months ago

Which component is affected?

Qwik Runtime

Describe the bug

I was randomly writing some edge case code (orphaned signals in this case) to see what happens when I first encountered this bug. Trying to reproduce the bug in the playground later revealed that this bug depends on the returned JSX markup.

In the following reproduction, app.tsx exports two components V1 and V2, which have different JSX markup (V1's children are nested in extra p's) but are otherwise the same.

Expected behavior: apart from the visual differences (from not having extra p's), both components should show the same behavior, that is:

Actual behavior: Once V2's Child unmounts for the first time, the parent counter gets stuck and no longer updates. V1 does not show this behavior and works as expected.

Reproduction

https://qwik.builder.io/playground/#v=1.4.2&f=5Va9DoIwEN55ClwICWAENgKdfATD7oA4kGA0xoH03b3eHW1BEkEdSFz4aa%2FXu%2B%2B7PztoklT7Y0dNaNovfmJhY%2BpoeU5cEQ5lDChMhhbtY3mvrnumrjBX%2BzswuBeDijnYGx6zBc%2Ftg0q3LX46NrcKpfqAZmAuBkscckxv78hSuHgLiX%2Bv6BlFUkSRHon4cDeSksuUBoEUQTBUqpJsrom9y6QNHN%2BMlqQ4tHXdVK92j456npsTemBiodySEFHkDlsEsUTJP%2BI5WTXPn7M7ze03zP6YxgUkMneOQxj2%2BNm0dUiBzJA6%2BMw443N%2B0YwnBKiZJHiCWT1yg3IaoM1Zl1Z8uAll8U4NAOtUGyri7HbU8R4j8789KYlT41kZhyoTjTVraU3QBnRnUr%2FJ%2B0b1BA

Steps to reproduce

No response

System Info

System:
    OS: Linux 4.14 Arch Linux ARM
    CPU: (8) arm64 Cortex-A55
    Memory: 860.85 MB / 3.58 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.10.0 - /usr/sbin/node
    npm: 10.3.0 - /usr/sbin/npm
  npmPackages:
    @builder.io/qwik: ^1.3.5 => 1.4.2
    @builder.io/qwik-city: ^1.3.5 => 1.4.2
    undici: * => 6.5.0
    vite: ^5.0.11 => 5.0.12

Additional Information

No response

wmertens commented 7 months ago

Thank you for the repro, that indeed looks like a bug.

JerryWu1234 commented 6 months ago

Let me take a look. It would be great if you could offer a clue that off the top of your head about this bug.

wmertens commented 6 months ago

Since we have v2 well underway and it rebuilds some of this code, let's wait until we can test this with v2 alpha.

aarbi commented 6 months ago

Also I want to point out another related issue with the example app we get after running pnpm create qwik and choosing the Basic App starter, the counter there is broken and can reproduced quickly by running pnpm preview, hitting the "+" button makes the number drops from 70 to 50