Per-scope takeover for live nodes whose server value is still streaming (D8 follow-up to #3817)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- frontend
調査の方向性
Read documentation/plans/stage8-connection-transport.md for D8 context, then study packages/web/test/hydration/live-shell-source-3764.spec.tsx to understand current behavior and required test cases. Examine the hydration implementation in the web package to see how live nodes take over and how loadingValue exemption works. Implement either server-recorded readers or value-replay with solid.LiveResumeFrom, ensuring existing tests pass and adding a test for a fast-boundary read with a pending slow boundary.
索引モデルが issue の本文から書いたものです。
説明
Problem
D8 (Stage 8, documentation/plans/stage8-connection-transport.md) makes a live node take over, meaning it re-runs its compute and opens the live connection, when its own hydration scope releases. For a node in the shell, that's when the root pass ends. Its stated goal is "No live node waits on another boundary."
#3817 (fixing #3764) added an exception. A live node whose serialized value is still in flight when it arms takes over at hydration end, after the last streamed boundary on the page has hydrated. Nodes with a loadingValue are exempt. The fallback is needed because the boundary that reads the node claims its server DOM against that value. If the node takes over before the value arrives, it has nothing to replay, and the boundary can't claim: you get a duplicate or unclaimed DOM. That happens with the real live() transport too, since its local first yield on takeover is the value the node adopted, and there isn't one yet.
The cost is latency. A live source created in the shell and read only inside a streamed <Loading> now goes live only when the slowest boundary on the page hydrates. In practice that covers nearly every real source in that shape: a shell memo read only inside <Loading> misses the shell flush unless its first value is ready synchronously. In a server probe, three microtasks were already too late.
Motivating case: the room demo
examples/room's header creates presence in the shell and reads it inside <Loading>. The Archive panel lower on the page takes 4 s. With the fallback, the tab joins the room, and other tabs see it join, only after the Archive lands. The demo exists to show the opposite. Its comments now note the exception.
Why the client alone can't do better
The ideal gate is "take over once every boundary that reads this node has hydrated." The client can't know that set. When the root pass ends, a pending boundary is an owner with no children, because its children are created when its fragment arrives. So until each boundary hydrates, nothing on the client can tell whether it will read the node. Walking the node's current observers only sees readers that already exist.
Candidate directions
- Server-recorded readers.
- During SSR, record for each serialized shell node the ids of the streamed boundaries that read it, and ship that list with the payload, either beside the value or in the readers' fragment data.
- On the client, the node's gate counts down as those boundaries release, falling back to hydration end, and nodes read by no boundary keep root scope.
- This preserves D8 exactly, at the cost of a read hook on the server memo path, payload bytes, and an estimated 120–250 B minified on the client.
- Take over once the node's own value has arrived, replaying it.
- Keep the per-scope gate, but for an in-flight node also wait until its serialized value lands. Then stamp the takeover with that value (
solid.LiveResumeFrom), so the transport yields it locally before connecting and the reading boundary still claims against the server value. - A prototype made during #3817's review found:
- Flipping the gate on the settle alone loses a race: the takeover supersedes the adoption before the value commits. Resuming from the landed value fixes that deterministically.
- It fixes #3764's case A and keeps the fast-boundary and
loadingValuecases prompt. - It relies on the source honoring the replay protocol, so hand-rolled branded iterables still fail.
- Residual failure: when a value lands before a slower boundary that reads it, and the server's data genuinely changes in that gap, the boundary claims against changed data.
- As written it added about +183 B minified to hydrating bundles (three scenarios over cap). A tighter version is likely near 100 B.
- Keep the per-scope gate, but for an in-flight node also wait until its serialized value lands. Then stamp the takeover with that value (
Either direction should keep #3817's tests (both case-A timings in packages/web/test/hydration/live-shell-source-3764.spec.tsx) and the loadingValue test passing. It should also add a test for a node read by a fast boundary while an unrelated slow boundary is pending, which should connect before the slow boundary lands.
- 主要言語
- TypeScript
- スター
- 36.1k
- フォーク
- 1.1k
- 平均マージ
- 11時間 25分
- マージ済み PR(30日)
- 345
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs/solid のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
メンテナーはふだん 1 日以内に返信
-
Select loses its bound value when options load asynchronously対応中かも @MokiMeow が今日担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 45/100
solidjs/solid#3928 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 24/100
solidjs/solid#3923 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
MystenLabs/MemWal#1163 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Mondriaan
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
knaw-huc/textannoviz#709 ·
メンテナーはふだん 1 日以内に返信
-
billion-context-pi
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ranxianglei/billion-context#2521 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Add: YRF Music Nepalオープンstreams:add
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100