[2.0.3 / main] Non-keyed <Show> halts with "Stale read from <Show>." when the update that closes it waits on an async read

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

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

@Asadshah7950 がすでに取り組んでいます。

2026年11月25日 から。

  • #5206 @Asadshah7950 による — オープン

評価

難易度
4/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript, node.js
領域
frontend

調査の方向性

The bug sits in the reactive core: the non-keyed Show path and the sync memo that reads the accessor during a held update, so start with the Show implementation and the signals scheduler. Run the reproduction script with node --conditions=browser show-stale-string.mjs; it currently halts with [REACTIVITY_HALTED] before its last line. Done means the script prints all three view and read entries, matching the keyed output, without halting.

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

説明

Describe the bug

A non-keyed <Show> with a function child halts the page when the update that makes when falsy also waits on an asynchronous read elsewhere. A memo inside the child runs again before the Show removes the child, its read of the accessor throws "Stale read from .", and Solid logs [REACTIVITY_HALTED]. Nothing updates after that.

In the script below, when and the child both read ahead with latest, and a memo beside them waits on a promise once the status changes. It stops before it prints its last line:

[REACTIVITY_HALTED] Stale read from <Show>.

With keyed: true and the child reading value instead of value(), the same script prints every update:

{"views":["shown","hidden","shown"],"reads":["failed/modelFailed","failed/second","failed/third"]}

There is a second form. With when written as the compiler emits status === "failed" ? failure : undefined, with its nested memo, the accessor returns undefined to the child's memo instead of throwing, although its type is Accessor<NonNullable<T>>. I can post that script too.

Found at: solid-js 2.0.3 with @solidjs/signals 2.0.3, and main at da28cd5. Also on 2.0.0.

Your Example Website or App

The script under "Steps to Reproduce"

Steps to Reproduce the Bug or Issue

Save as show-stale-string.mjs in a folder with solid-js installed and run node --conditions=browser show-stale-string.mjs.

// node --conditions=browser show-stale-string.mjs
import { Show, createMemo, createRenderEffect, createRoot, createSignal, flush, latest } from "solid-js";

const [data, setData] = createSignal({ status: "failed", reason: "modelFailed" });
const gate = Promise.withResolvers();
const views = [];
const reads = [];

createRoot(() => {
  const job = createMemo(() => data());
  const view = Show({
    get when() {
      return latest(data).reason;
    },
    children(value) {
      const read = createMemo(() => `${latest(data).status}/${value()}`, { sync: true });
      createRenderEffect(read, (text) => {
        reads.push(text);
      });
      return "shown";
    },
  });
  createRenderEffect(
    () => view(),
    (shown) => {
      views.push(shown ?? "hidden");
    },
  );
  const slow = createMemo(() => (job().status === "failed" ? 0 : gate.promise));
  createRenderEffect(slow, () => {});
});
flush();
setData({ status: "queued" });
flush();
gate.resolve(1);
await new Promise((resolve) => setImmediate(resolve));
flush();

setData({ status: "failed", reason: "second" });
flush();
setData({ status: "failed", reason: "third" });
flush();
await new Promise((resolve) => setImmediate(resolve));
flush();
console.log(JSON.stringify({ views, reads }));
Expected behavior

The update completes: the Show removes the child, and the later updates show it again, as they do with keyed.

Screenshots or Videos

No response

Platform
  • OS: Linux
  • Runtime: Node.js 26 with --conditions=browser; first seen in Chromium
  • Version: solid-js 2.0.3, @solidjs/signals 2.0.3
Additional context

This looks close to #4354, a branch re-run during the hold that closes it, and to the shown guard from #3948. There the re-run came from an unrelated write; here it comes from the held update itself, with no action or optimistic write. #4137 and #4848 are the other neighbours I found, both fixed.

We met it on a page that polls its data through @tanstack/solid-query 6.0.0-rc.6 and shows a failed job's reason in a non-keyed <Show>. When the job changed state elsewhere, the page logged the error thousands of times and stopped following later polls. We use keyed there now.

主要言語
TypeScript
スター
37k
フォーク
1.2k
平均マージ
8時間 43分
マージ済み PR(30日)
365

環境構築

はじめの一歩

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

solidjs/solid のほかの issue

solidjs/solid の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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