QwikDev / QwikDev/qwik

[🐞] Running multiple action$ simultaneously only runs one

Open
#3,334 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug router
Dominant language
TypeScript
Stars
22.1k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Which component is affected?

Qwik City (routing)

Describe the bug

Doing:
Trying to run() multiple actions when a button is clicked.

      <button onClick$={() => {
        foo.run();
        bar.run();
      }}>Foo Bar</button>

Expect:
These actions have run.

Happened:
Randomly selected only one action has run.

Reproduction

https://github.com/genki/qwik-test/tree/no_multi_actions

Steps to reproduce

git clone the the above and npm run dev
The reproduction code is in src/router/index.tsx
Please note this expects the latest qwik is located ~/project/clone/qwik

System Info
System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M2
    Memory: 84.31 MB / 24.00 GB
    Shell: 3.5.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 19.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.5.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Firefox: 110.0.1
    Safari: 16.2
  npmPackages:
    @builder.io/qwik: file:~/project/clone/qwik/packages/qwik => 0.21.0
    @builder.io/qwik-city: file:~/project/clone/qwik/packages/qwik-city => 0.5.3
    undici: ^5.20.0 => 5.20.0
    vite: 4.0.4 => 4.0.4
Additional Information

I faced this issue as well at other situation such that several actions run at the same timing.
For example, when one signal triggers several useTask$ at once and each of them runs different actions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction is in src/router/index.tsx; clone https://github.com/genki/qwik-test/tree/no_multi_actions and run npm run dev with the latest Qwik checkout available at ~/project/clone/qwik. Trace how Qwik City routing handles the two action$ run() calls and the related simultaneous action execution. Done means both foo and bar actions run reliably when triggered together, including the reported useTask$ scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.