SUSPENDERS operation is decoded with the wrong length, adding a phantom node
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
Hướng nghiên cứu
Đọc packages/agent-react-devtools/src/component-tree.ts quanh dòng 329–334 và so sánh trường hợp SUSPENDERS của decoder với bố cục 5 + environmentCount được mô tả trong issue. Theo dõi cách mảng operations được cung cấp được tiêu thụ, sau đó chạy bản tái hiện Suspense với hai boundary và xác nhận rằng nó không còn thêm một nút Anonymous có id 0.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 251
- Fork
- 13
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của callstackincubator/agent-react-devtools
-
get component shows props and state as the dehydrated {data, cleaned, unserializable} wrapperĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
callstackincubator/agent-react-devtools#56 · 1 bình luận ·
Tất cả issue của callstackincubator/agent-react-devtools
Issue tương tự
-
api bug priority:low ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wondermoney/wondermoney#862 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
rootsiemen/seo-agent-tools#70 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
alvinunreal/oh-my-opencode-slim#1971 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
elecnix/bellwether#467 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày