Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[2.0] A memo whose first read rejected reads `undefined` (not NotReady) in a verdict pass while it is re-asked

Đang mở
#4,244 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Start with packages/signals/src/core/async.ts and core/verdict.d.ts, then trace how notifyStatus and verdictValue handle an initially rejected memo when it is re-asked. Reproduce with the issue's createSignal, createMemo, and isPending example; compare the observed [true, undefined] with the expected NotReadyError. Done when the re-ask and related latest or createDeferred reads no longer expose undefined before a value lands.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Version: solid-js / @solidjs/signals 2.0.0-rc.16, rc.17 and rc.18 (not rc.15).

The isPending contract (signals core/verdict.d.ts): "A read that has no value yet is loading, not pending — the probe reports only updates to a value that already exists."

Repro (no boundaries needed):

const [n, setN] = createSignal(0)
const m = createMemo(() => {
  const i = n()
  return i === 0 ? Promise.reject(new Error('boom')) : new Promise(r => setTimeout(() => r({ key: 'a' }), 50))
})
createRenderEffect(
  () => { try { return [isPending(() => m()), m()] } catch (e) { return [e] } },
  v => console.log(v)
)
// after the rejection: StatusError, as expected
setN(1) // re-ask
// observed until the landing: [true, undefined]   -- expected: NotReadyError (no value has ever landed)

Cause (dev build): notifyStatus(STATUS_ERROR) clears STATUS_UNINITIALIZED (packages/signals/src/core/async.ts), so after the re-ask verdictValue treats the node as initialized and pending and returns el._value (undefined). latest(() => m()) and createDeferred read the same.

Effect in an app: a list whose first read failed; its Retry re-asks it; a <Show when={isPending(() => page()) && …}> in the region (or any pass that probes isPending and then reads the page) dereferences undefined and throws a TypeError into the error boundary, so the retried rows never paint.

Ngôn ngữ chính
TypeScript
Star
36.2k
Fork
1.1k
Merge trung bình
10 giờ 38 phút
Pull request đã merge (30 ngày)
352

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của solidjs/solid

Tất cả issue của solidjs/solid

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.