Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐞] Spread Operator in Qwik Does Not Trigger Reactive Updates for Props #7397

Open
yash-builder opened this issue Mar 6, 2025 · 1 comment
Labels
COMP: runtime TYPE: bug Something isn't working

Comments

@yash-builder
Copy link

Which component is affected?

Qwik React

Describe the bug

In Qwik, when spreading an object ({...state.helloProps}) into a component's props, the UI does not update when the object properties change. The workaround requires forcing updates by using a unique key (e.g., JSON.stringify(state.helloProps)) to ensure the component re-renders.

This issue occurs because Qwik does not track object property changes inside the spread operator unless the reference itself changes.

Reproduction

https://qwik.dev/examples/introduction/hello-world/#f=7VZNS8NAEL33VwxFaAJhpRU8rEm9ePKgB%2F9AJZtKaLHiFwnL%2FnffzG7SJo3FSwTBU0OTTd6beTPvHYpmcTGomqT13JP6mXimHmzW0U9ICpbWu921bqKAO5IVJ4ElnsFOopwXLs7IWYU%2FXXou9yG1yaTtqcG2eo8qtLFj9xWfiK%2BaN1fkfibwkEjEDLKWd2ThWKCF4RMeDgvtiE1CNzWWbpm35qJDMRjwniTHKN8GvvJssR00pfIrI5FNeainvGM%2BEEYEj9pDkHIgd0jMOctsVHwmVGyFRTT0MLgUWyVvix1E4cNci6IJPZawP9FWTbP5S0WoZmkICzvfzBL4jTEgqmm%2BSJAwXp%2FKZ02X5NySgsZC52BMQn4Y9jiffoMzPhpKfcGtUqr%2FcaYd1D8igEj0WJj4EIrXaB%2BQNGJERJJJVpuiXtHtw%2F0dCsI6Ldf16SrhQGa7B34dOiYVGQI5jocfg%2BHxQj3fjUIfjb%2F4d6W%2F6kpf

Steps to reproduce

  1. Run the provided Qwik component.
  2. Type into the input field to update state.helloProps.foo.
  3. Observe the different ways Hello receives props:
  • The first spread case does not update.
  • The spread (deopted) case works because of explicit access to the object.
  • The with key JSON.stringify case works because it forces re-render.
  • The explicit prop case works correctly.

System Info

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M4
    Memory: 153.72 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.11.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 134.0.6998.44
    Safari: 18.1.1
  npmPackages:
    @builder.io/qwik: ^1.12.0 => 1.12.0 
    @builder.io/qwik-city: ^1.12.0 => 1.12.0 
    @builder.io/sdk-qwik: link:builder/packages/sdks/output/qwik => 0.18.4 
    typescript: 5.4.5 => 5.4.5 
    undici: * => 7.3.0 
    vite: 5.3.5 => 5.3.5

Additional Information

Expected Behavior:

When spreading state.helloProps into <Hello {...state.helloProps} />, the component should update as soon as state.helloProps.foo changes.

@yash-builder yash-builder added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Mar 6, 2025
@Varixo Varixo added COMP: runtime and removed STATUS-1: needs triage New issue which needs to be triaged labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: runtime TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants