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

[🐞] V2: Bug when signal of useComputed$ is used in useTask$ or useVisibleTask$ #7213

Open
fabian-hiller opened this issue Dec 30, 2024 · 1 comment
Assignees

Comments

@fabian-hiller
Copy link
Contributor

fabian-hiller commented Dec 30, 2024

Which component is affected?

Qwik Runtime

Describe the bug

When a useComputed$ signal is read in useVisibleTask$, the task is executed twice (or multiple times if multiple useComputed$ are used). Also, useComputed$ is unnecessarily re-executed afterwards.

Reproduction

https://stackblitz.com/edit/github-o2f6fj9n-meq2plo7?file=src%2Froutes%2Findex.tsx

Steps to reproduce

  1. Open StackBlitz link
  2. Open and clear browser console
  3. Reload Qwik App

Now you should see this in the console:

useVisibleTask$: Do stuff with text...
useVisibleTask$: Do stuff with text...
useComputed$: Computing initial text...

The expected output would be:

useVisibleTask$: Do stuff with text...

This is because useComputed$ should only run once on the sever and useVisibleTask$ should only run once in the browser. A similar bug exists when using useTask$.

System Info

-

Additional Information

No response

@fabian-hiller fabian-hiller added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Dec 30, 2024
@Varixo Varixo added COMP: runtime VERSION: upcoming major and removed STATUS-1: needs triage New issue which needs to be triaged labels Dec 31, 2024
@Varixo Varixo self-assigned this Dec 31, 2024
@Varixo Varixo moved this to In progress in Qwik Development Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

No branches or pull requests

2 participants