[2.0.4] `isPending()` stays `false` while an input change's request is out under an optimistic guess
Maintainer thường phản hồi trong vòng 1 ngà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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Read core/async.ts, especially notifyStatus, joinFuture, and propagateStatus, to understand why the guess branch does not notify readers. Reproduce with the linked Solid Playground and inspect packages/web/test/async-gen/rulings/S-44.ts; the existing it.fails test is the likely place to update. Confirm that tracked isPending(comments) becomes true during the held request and false after the refresh, while the held screen and optimistic guess remain correct.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
comments is an optimistic async value over a signal sel. An action guesses comments and then waits. Changing sel while the action is out is held with the action, so the screen keeps the old sel beside the guess. But isPending(comments) stays false while the request for the new sel is out, and turns true only once that request has answered.
Reproduction
Playground link (2.0.4)
import { createSignal, createOptimistic, action, refresh, isPending, latest, Loading } from "solid-js";
const wait = (ms: number) => new Promise<void>(r => setTimeout(r, ms));
// Answers after 1s: 3 → 4, 1 → 2.
const fetchComments = async (sel: number) => (await wait(1000), sel + 1);
export default function App() {
const [sel, setSel] = createSignal(3);
const [comments, setComments] = createOptimistic(() => fetchComments(sel()));
const post = action(function* () {
setComments(9); // the guess
yield wait(4000); // the post request
refresh(comments);
});
return (
<Loading>
<button onClick={() => post()}>1. post</button>
<button onClick={() => setSel(1)}>2. select 1</button>
<p>
sel {sel()} | comments {comments()} | latest {latest(comments)} | isPending{" "}
{String(isPending(comments))}
</p>
</Loading>
);
}
Steps
- Wait for
sel 3 | comments 4 | latest 4 | isPending false. - Click 1. post.
- Within a second, click 2. select 1. Watch the line for the next ~5 seconds.
Expected
isPending true from step 3 until the post's refresh lands: changing sel asks a new question, and that change "is held with the post" (S-44; F-9, D-23: pending while a new question has no committed answer).
Actual
| screen | |
|---|---|
| after step 2 | sel 3 | comments 9 | latest 9 | isPending false |
step 3, select 1 request out (1s) |
sel 3 | comments 9 | latest 9 | isPending false |
select 1 answered, post still out |
sel 3 | comments 9 | latest 9 | isPending true |
| post done, refresh lands | sel 1 | comments 2 | latest 2 | isPending false |
So a disabled={isPending(comments)} or a "refreshing…" indicator stays off for exactly as long as the new request is out. The held screen itself is right. It needs the guess: without setComments(9), isPending is true while the select 1 request is out. An untracked isPending(comments) called right after step 3 also returns true; only the tracked read misses it. Same in 2.0.4 and main (510bb8d01), dev and prod.
Cause
When the input change makes comments re-ask while a guess is on it, notifyStatus (core/async.ts) takes the guess branch: it joins the action's hold (joinFuture) and returns before propagateStatus. So the readers of comments, including the isPending probe, are never notified. The probe re-runs only when the answer lands.
Related
Follow-up to #4336 (fixed in #4337, which built the held screen). The pending frame is S-44's setSel(1) row, pinned in the repo as ruled-not-built (packages/web/test/async-gen/rulings/S-44.ts, an it.fails test).
- Ngôn ngữ chính
- TypeScript
- Star
- 37k
- Fork
- 1.2k
- Merge trung bình
- 8 giờ 43 phút
- Pull request đã merge (30 ngày)
- 365
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 solidjs/solid
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handlesCó thể đã có người làm @MilindChatrabhuji đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid
Issue tương tự
-
agentscan:mixed-signals pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
vueuse/vueuse#5737 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Marker-Inc-Korea/AutoRAG#2288 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Resources: New templates of Guangzhou Metro Line 13Có thể đã có người làm @rmt-svc đã nhận hôm nay. Đang mởresources
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
railmapgen/rmg-templates#2730 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
web
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày