[2.0.4] After a `refresh()` of an optimistic store has landed, an input switched under a guess is no longer held with the action
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
Start with the provided SolidJS playground and reproduce the refresh-before-action sequence. Trace the setter landing path in store/thinProjection.ts, the _reask cleanup in core/scheduler.ts, and hold handling in store/thinOptimistic.ts. Done means changing filter after the refresh preserves the action’s hold and keeps the displayed value at all; add a regression test for that sequence.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
An optimistic store's async function reads a signal filter. An action adds a guess to the store and then waits. Switching filter while the action is out is held with the action, so the screen keeps all beside the all list and the guess. But once a refresh() of the store has landed, the same switch isn't held: filter shows open right away, beside the old list and the guess, until the action ends.
Reproduction
import {
createSignal,
createOptimisticStore,
action,
refresh,
Loading,
} from "solid-js";
type Todo = { id: string };
const fetchTodos = (filter: string) =>
new Promise<Todo[]>((r) =>
setTimeout(() => r([{ id: filter === "all" ? "a" : "b" }]), 50),
);
export default function App() {
const [filter, setFilter] = createSignal("all");
const [todos, setTodos] = createOptimisticStore<Todo[]>(
async () => await fetchTodos(filter()),
[],
);
const add = action(function* () {
setTodos((ts) => [...ts, { id: "z" }]); // the guess
yield new Promise(() => {}); // never ends: the action stays out
});
return (
<Loading>
<button onClick={() => refresh(todos)}>1. refresh</button>
<button onClick={() => add()}>2. add</button>
<button onClick={() => setFilter("open")}>3. switch filter</button>
<p>
{filter()} | {todos.map((t) => t.id).join(",")}
</p>
</Loading>
);
}
Steps
- Click 1. refresh and let it land (
all | a). - Click 2. add:
all | a,z. - Click 3. switch filter.
Then reload and do the same without step 1.
Expected
all | a,z after step 3, as without step 1. The switch changes the input of the store the guess sits on, so it "is held with the guess's hold until it commits" (D-34, the ruling in #4337). A refresh that already landed shouldn't change that.
Actual
| after step 3 | |
|---|---|
| without step 1 | all | a,z |
| with step 1 | open | a,z |
open | a,z stays until the action ends, even after the open request answers. It needs the guess (the same action without setTodos is held) and the store (createOptimistic is held). Same in 2.0.4 and main (510bb8d01), dev and prod.
Cause
When the refreshed store lands, it settles through the setter path (landBySetter, store/thinProjection.ts) without staging a value, so the cleanup that clears its _reask flag (core/scheduler.ts) never runs. The next filter change reads the stale flag and is treated as a quiet re-ask, so it never joins the action's hold (store/thinOptimistic.ts).
Related: a regression of #4337 (#4336) through a prior refresh().
- 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ự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
activepieces/activepieces#17974 · 1 bình luận ·
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 66/100
OHDSI/Data2Evidence#3777 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AOSSIE-Org/PictoPy#1802 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Termix-SSH/Plugin-Snippets#26 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-reported bug from-app needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nightly-labs/openbot#20504 ·
Maintainer thường phản hồi trong vòng 1 ngày