SUSPENDERS operation is decoded with the wrong length, adding a phantom node
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
調査の方向性
packages/agent-react-devtools/src/component-tree.tsの329〜334行付近を読み、decoderのSUSPENDERSケースをissueで説明されている5 + environmentCountのレイアウトと比較してください。渡されたoperations arrayがどのように消費されるかを追い、次に2つのboundaryを使ったSuspenseの再現を実行して、id 0のAnonymousノードが追加されなくなったことを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Summary
The operations decoder skips 2 + numChanges * 4 values for SUSPENSE_TREE_OPERATION_SUSPENDERS (12). Current backends write 5 + environmentCount values per change. When one commit changes suspenders on two or more Suspense boundaries, the leftover values are parsed as opcodes, and a phantom Anonymous node with id 0 gets added to the tree.
Environment
- agent-react-devtools 0.5.0 (same code on
main@ d25f34b) - react / react-dom 19.3.1, react-devtools-core 8.0.0
- Node 26.8.1, Windows 11 (with local fixes for https://github.com/callstackincubator/agent-react-devtools/issues/64 and https://github.com/callstackincubator/agent-react-devtools/issues/65; this code path is platform-independent)
Repro
const pending = new Promise(() => {});
function Loader({ p }) { use(p); return <i>done</i>; }
function App() {
const [on, setOn] = useState(false);
useEffect(() => { setTimeout(() => setOn(true), 3000); }, []);
return (
<div>
<Suspense fallback={<b>A...</b>}>{on ? <Loader p={pending} /> : <i>a</i>}</Suspense>
<Suspense fallback={<b>B...</b>}>{on ? <Loader p={pending} /> : <i>b</i>}</Suspense>
</div>
);
}
After both boundaries suspend in the same commit:
$ agent-react-devtools count
5 components (?:2 susp:2 fn:1)
$ agent-react-devtools find Anonymous
@c?(id:0) [?] Anonymous
The operations message for that commit (captured from the backend websocket):
[1,1,0, 10,1,2,3,4, 12,2, 3,1,0,1,0, 4,1,0,1,0]
Each change is id, hasUniqueSuspenders, endTime, isSuspended, envCount, ...envIds. The decoder skips 10 values after the opcode and lands on 1,0, which it reads as TREE_OPERATION_ADD for id 0.
Cause
component-tree.ts L329-L334. The encoder is in react-devtools-shared renderer.js (flushPendingEvents); its own printOperationsArray reads the same 5 + N layout.
Fix
case SUSPENSE_TREE_OPERATION_SUSPENDERS: {
this.extendedAddFormat = true;
const numChanges = operations[i + 1];
i += 2;
for (let c = 0; c < numChanges; c++) {
i += 4; // id, hasUniqueSuspenders, endTime, isSuspended
i += 1 + operations[i]; // envCount + env string IDs
}
break;
}
With this change the same repro reports 4 components (susp:2 ?:1 fn:1) and no Anonymous node.
- 主要言語
- TypeScript
- スター
- 251
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstackincubator/agent-react-devtools のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
callstackincubator/agent-react-devtools#56 · コメント 1 件 ·
callstackincubator/agent-react-devtools の issue をすべて見る
似ている issue
-
api bug priority:low ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wondermoney/wondermoney#862 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
rootsiemen/seo-agent-tools#70 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
alvinunreal/oh-my-opencode-slim#1971 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
elecnix/bellwether#467 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信