#9081·qwik

[] Only the first clientOnly async computed starts on a cold load (_res iterates a clobbered _captures)

Author: ixcansCreated Sep 29, 2026Updated Sep 29, 2026

Which component is affected?

Qwik Runtime

Describe the bug

When a page is loaded directly (typed URL, refresh, bookmark), only the first clientOnly async computed on the page starts. Every other one stays pending forever, with no error. With a layout and a page that each fetch data through useComputed$(async …, { clientOnly: true }), the layout's data loads and the page's data never does, so the page sits on its loading state. Client-side navigation to the same page works, because that path renders the component instead of resuming it.

Expected: every clientOnly computed starts after resume.

Cause. SSR serializes all clientOnly signals into one q-d:qidle handler with several captures (in the reproduction: q-d:qidle="/@qwik-handlers#_res#8 1"). _res in packages/qwik/src/core/shared/jsx/bind-handlers.ts loops over the module-level _captures and calls $computeIfNeeded$() on each clientOnly signal:

typescript
if (_captures) {
  for (let i = 0; i < _captures.length; i++) {
    const capture = _captures[i];
    if (capture instanceof AsyncSignalImpl && capture.$flags$ & AsyncSignalFlags.CLIENT_ONLY) {
      capture.$computeIfNeeded$();
    }
  }
}

$computeIfNeeded$() → $computeAsync$() → $runComputation$() resolves the compute QRL synchronously ($resolve$, or the bound function when it is already resolved), and both go through ensureQrlCaptures, which does _captures = qrl.$captures$ = …. So after the first signal starts, _captures is the compute function's own captures, and the loop carries on over the wrong array. The remaining signals are never started. The comment on _captures says it is "used one time per invocation, synchronously", which _res breaks by reading it across iterations.

It needs at least two clientOnly signals on the page, and the first one's compute function must capture something (with no captures _captures is not overwritten).

main (b3526b6fc) still has the same loop. The existing _res unit tests only check that it does not throw, so nothing runs two real signals through it.

Reproduction

https://github.com/ixcans/qwik-clientonly-res-repro

Steps to reproduce

bash
pnpm install
pnpm dev

Open http://localhost:5199/ directly in a fresh tab.

  • Expected: layout: layout data for production and page: page data for workflows
  • Actual: layout: layout data for production and page: LOADING (never resolves)

I reproduced this on both 2.0.0-beta.43 and 2.0.0-beta.45, and it fails on every reload of the reproduction.

System Info

bash
  System:
    OS: Linux 7.0 Ubuntu 26.04.1 LTS
  Binaries:
    Node: 26.8.2
    pnpm: 12.3.4
  Browsers:
    Chromium (Playwright, headless)
  npmPackages:
    @qwik.dev/core: 2.0.0-beta.45
    @qwik.dev/router: 2.0.0-beta.45
    typescript: 5.9.3
    vite: 8.3.1

Additional Information

Snapshotting the array before the loop fixes it. I patched node_modules/@qwik.dev/core/dist/core.mjs in the reproduction, and with the patch both signals load; reverting the patch brings the bug back:

diff
-    if (_captures) {
-      for (let i = 0; i < _captures.length; i++) {
-        const capture = _captures[i];
+    const captures = _captures;
+    if (captures) {
+      for (let i = 0; i < captures.length; i++) {
+        const capture = captures[i];

Workaround for apps: read untrackedPending on each query from a useVisibleTask$(..., { strategy: 'document-ready' }), which starts the computation independently of _res.