[🐞] SSR waits for every `blockSSR: false` loader before rendering, even one no component reads

オープン
#9,239 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, typescript

調査の方向性

Start in the server-side useQwikRouter loader wait described in the issue, then trace how blockSSR and whenReady govern head resolution and rendering. Reproduce with the linked minimal example, where the unread 1.5-second loader delays the page, and check that rendering can proceed without waiting for it while a loader read still suspends as expected.

索引モデルが issue の本文から書いたものです。

説明

Which component is affected?

Qwik Router

Describe the bug

Version: @qwik.dev/router 2.0.0-rc.3 (same code on main at 2026-10-19), experimental: ["catchBoundary", "pendingBoundary", "blockSSR"].

The docs (Background loaders) say a blockSSR: false loader is started by the server without waiting: rendering begins at once and only a read of .value suspends. In practice the first SSR render starts only after all loaders have resolved, including background ones that no component reads. So a slow background loader delays the whole page, which is what blockSSR: false is meant to avoid.

Minimal reproduction

src/routes/i/index.tsx: useFast (100 ms) is read inside <Pending>, useSlow (1.5 s) is never read.

import { component$, Pending } from "@qwik.dev/core";
import { routeLoader$ } from "@qwik.dev/router";

const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));

export const useFast = routeLoader$(
  async () => {
    console.log(`[i] fast start ${Date.now() % 100000}`);
    await wait(100);
    console.log(`[i] fast end ${Date.now() % 100000}`);
    return "fast";
  },
  { blockSSR: false },
);

/** Never read by any component. */
export const useSlow = routeLoader$(
  async () => {
    console.log(`[i] slow start ${Date.now() % 100000}`);
    await wait(1500);
    console.log(`[i] slow end ${Date.now() % 100000}`);
    return "slow";
  },
  { blockSSR: false },
);

const Fast = component$(() => {
  const fast = useFast();
  return <p id="fast">{fast.value}</p>;
});

export default component$(() => {
  console.log(`[i] page render ${Date.now() % 100000}`);
  return (
    <main>
      <h1>I: SSR waits for background loaders</h1>
      <Pending fallback$={() => <p>loading…</p>}>
        <Fast />
      </Pending>
    </main>
  );
});

Server log and timing of the HTML stream (node verify2.mjs I):

I "fast" (100 ms loader) reached the browser after 1521 ms, whole page after 1523 ms
  [i] fast start 13162
  [i] slow start 13162
  [i] fast end 13263
  [i] slow end 14664
  [i] page render 14666   <- the component renders only after the unread slow loader
Where

On the server useQwikRouter does _waitOn(whenReady(() => { for (const loader of loaders) loaderState[id].untrackedPending }).then(() => resolveHead(...))): the container waits for every loader before head is resolved and the body renders.

Expected

Background loaders do not hold the render. head would still wait for one if it reads it (resolveValue throws the promise and whenReady awaits it).

Reproduction

https://github.com/Pancio-code/qwik2-rc3-repros

Steps to reproduce
git clone https://github.com/Pancio-code/qwik2-rc3-repros
cd qwik2-rc3-repros && npm install
npm run build.client && npm run build.preview
npx vite preview

Open /i/ (source: src/routes/i/index.tsx). node verify2.mjs runs the same case headless with Playwright and prints the result (see the README).

System Info
System:
    OS: Linux 7.0 Ubuntu 26.04.1 LTS 26.04.1 LTS (Resolute Raccoon)
    CPU: (32) x64 Intel(R) Core(TM) i9-14900HX
    Container: Yes
    Shell: 5.3.9 - /bin/bash
  Binaries:
    Node: 24.21.0 - /home/pancio_o/.nvm/versions/node/v24.21.0/bin/node
    npm: 11.19.0 - /home/pancio_o/.nvm/versions/node/v24.21.0/bin/npm
  Browsers:
    Firefox: 158.0
    Firefox Developer Edition: 158.0
    Chromium (Playwright 1.64.1, used by `npm run verify`)
  npmPackages:
    @qwik.dev/core: 2.0.0-rc.3 => 2.0.0-rc.3 
    @qwik.dev/router: 2.0.0-rc.3 => 2.0.0-rc.3 
    typescript: 5.9.3 => 5.9.3 
    vite: 8.2.1 => 8.2.1
Additional Information

Found while moving a production app to 2.0.0-rc.3 (pages with several slow background loaders waited for the slowest one). We carry a local patch that skips loader.__blockSSR === false in that loop and can open a PR if the approach is welcome. Related: #9236, #9237, #9238 (same app).

主要言語
TypeScript
スター
22.1k
フォーク
1.4k
平均マージ
1日 13時間
マージ済み PR(30日)
159

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QwikDev/qwik のほかの issue

QwikDev/qwik の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。