QwikDev / qwik

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

[🐞] Some Qwik components interfere with resumability in a monorepo setup #6494

Open fprl opened 3 weeks ago

fprl commented 3 weeks ago

Which component is affected?

Qwik Runtime

Describe the bug

Hi everyone!

I have a monorepo setup where i'm importing some Qwik components. All of them work as expected except for two, which interferes with the rest of the logic of the component they are called.

When I import my component from @ooakt/ui/show-more inside a component that has some state, the show-more component works but the rest of the state/logic doesn't.

I tracked the error down to the useContextProvider in the show-more component. If I remove that line, the rest of the component where the show more is used works as expected.

Reproduction

Steps to reproduce

  1. cd apps/app
  2. npm run build
  3. npm run serve
  4. read instructions in the page.

PS: Don't test in dev mode, it works there!

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 1.65 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.0.0 - ~/.nvm/versions/node/v22.0.0/bin/node
    Yarn: 3.6.3 - /usr/local/bin/yarn
    npm: 10.5.1 - ~/.nvm/versions/node/v22.0.0/bin/npm
    pnpm: 8.12.1 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.5

Additional Information

No response

fprl commented 3 weeks ago

Okay I fixed the issue but I don't get why its happening. In the two components I had this issue I had something (function or const) declared in the same file and it was consumed inside the component(s). In the show-more component case, the context... once I move it to an external file and import it, everything worked. I'm not sure if this is my error in the tsconfig, or something related to vite bundling things or qwik not pointing to the right thing.