[2.0 rc.14] Docs: what a pending <Loading> subtree computes, commits and runs, so a view can be preloaded by rendering it
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 32/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
The request is about the boundaries documentation page, which the issue says covers only when <Loading> shows its fallback. Start by reading that page, then run the issue's reproduction (the gated and plain buttons) to confirm the three behaviours: children keep computing, a pending boundary never commits or runs effects, and a never-settling promise memo keeps it pending. Done means the page either documents those three points as supported with the preloading case as an example, or states which are not guaranteed. The maintainers need to decide which, so check with them before writing the text.
索引モデルが issue の本文から書いたものです。
説明
Summary
A view's data can be preloaded without listing what it reads: render it into a detached element inside a <Loading> held pending by a promise that never settles. Every read in its tree then starts, level by level as data arrives, while nothing is committed and no effect runs. This works on rc.14, but the docs don't describe any of the behaviour it depends on, so it may change without notice. This asks for that behaviour to be documented as supported, or for the docs to say it isn't.
Reproduction
A page with a list and one detail per row. run(true) renders it into a detached element behind a never-settling gate; run(false) renders the same tree without the gate, as a control.
import { render } from "@solidjs/web";
import {
createEffect,
createMemo,
For,
getOwner,
Loading,
onSettled,
runWithOwner,
} from "solid-js";
const t0 = performance.now();
const log: string[] = [];
const stamp = (entry: string) => log.push(`${Math.round(performance.now() - t0)}ms ${entry}`);
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
async function load<T>(name: string, value: T) {
stamp(`load ${name}`);
await delay(100);
return value;
}
function Detail(props: { id: string }) {
const detail = createMemo(() => load(`detail:${props.id}`, `detail ${props.id}`));
return <p ref={() => stamp(`element detail:${props.id}`)}>{detail()}</p>;
}
function Page() {
const list = createMemo(() => load("list", ["a", "b"]));
createEffect(
() => list(),
() => {
stamp("effect ran");
},
);
onSettled(() => {
stamp("onSettled ran");
});
return (
<ul ref={() => stamp("element list")}>
<For each={list()}>
{(id) => (
<li>
<Detail id={id} />
</li>
)}
</For>
</ul>
);
}
function run(gated: boolean) {
log.length = 0;
const host = document.createElement("div");
const dispose = runWithOwner(owner, () =>
render(() => {
const gate = createMemo(() => new Promise<never>(() => {}));
return (
<Loading fallback={null}>
{gated ? gate() : null}
<Page />
</Loading>
);
}, host),
);
setTimeout(() => {
console.log(log, host.innerHTML);
dispose();
}, 600);
}
let owner: ReturnType<typeof getOwner> = null;
export default function App() {
owner = getOwner();
return (
<main>
<h1>preview</h1>
<button type="button" onClick={() => run(true)}>
gated
</button>
<button type="button" onClick={() => run(false)}>
plain
</button>
</main>
);
}
Measured in headless Chromium under vite dev (times from run()):
| Loads started | Elements created (ref ran) |
Committed to the host | createEffect / onSettled |
Console | |
|---|---|---|---|---|---|
| gated | list at 0 ms, detail:a/detail:b at 103 ms |
ul, both p |
no (host empty) | never ran | nothing |
| plain | list at 0 ms, detail:a/detail:b at 105 ms |
ul, both p |
yes | ran at 208 ms | nothing |
What is undocumented
The boundaries page describes only when a <Loading> shows its fallback. The pattern above depends on three things it doesn't say:
- The children of a pending
<Loading>keep computing, and reads discovered as data arrives start too. - A pending boundary never commits its children or runs their effects (
createEffect,onSettled), however long it stays pending. - A memo whose value is a promise that never settles is an acceptable way to keep a boundary pending, without a diagnostic now or later.
Request
Document these three points as supported behaviour, for example on the boundaries page with this preloading use as the example, or say which of them is not guaranteed.
A primitive that does the same without building the DOM is requested in #3975.
(submitted by Claude Opus 5.5 on behalf of rvlzzr)
- 主要言語
- TypeScript
- スター
- 36.1k
- フォーク
- 1.1k
- 平均マージ
- 11時間 34分
- マージ済み PR(30日)
- 341
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs/solid のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
[diagnostics rc.14 / next] Browser bridge drops shared references, so `expectNoSilentHolds` throws on any capture with a `LONG_HOLD`対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
メンテナーはふだん 1 日以内に返信
-
hydrate() run mid-parse leaves dead server nodes beside fresh client copies (async entry script)オープン
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
by: ai-assisted frontend good-for: new-member spike
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Northeastern-Electric-Racing/Argos#847 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
SignalK/freeboard-sk#990 ·
メンテナーはふだん 1 日以内に返信
-
[missing-inheritance] audit review (1 preset)対応中かも @github-actions が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
osmberlin/tagging-schema-browser#363 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Albert-Weasker/niubigeo#205 ·
メンテナーはふだん 1 日以内に返信
-
area/frontend area/v2 kind/bug priority/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kubeflow/notebooks#1498 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信