Open
Description
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
- Open StackBlitz link
- Open and clear browser console
- 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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In progress