[2.0 next, regressed after rc.13] Awaited refresh returns the caller optimistic override
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
- 64/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ệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start with the reproduction in App.tsx and run repro.test.ts or snippet.test.ts using the linked setup. Then trace how refresh, action, and createOptimistic interact in Solid's source. Done means the awaited refresh returns the source value 2 rather than the optimistic override 99.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Refreshing an optimistic accessor inside its own action returns the optimistic guess instead of the source answer.
Your Example Website or App
Steps to Reproduce the Bug or Issue
- Use the source below with the selected Solid build (complete setup is linked above).
import { action, createOptimistic, createSignal, refresh, resolve } from "solid-js";
export default function App() {
const [value, setValue] = createOptimistic(() => Promise.resolve(2));
const [result, setResult] = createSignal("idle");
const save = action(function* () {
setValue(99); // The caller's optimistic guess, not server truth.
return yield refresh(value);
});
async function run() {
await resolve(value);
setResult(String(await save())); // Observed 99; the source returns 2.
}
return (
<>
<button id="trigger" onClick={run}>
Refresh inside action
</button>
<output id="answer">{result()}</output>
</>
);
}
- Paste into a Solid 2 playground. Click Refresh inside action and wait.
Expected behavior
Expected: The output becomes 2, the value produced by the source.
Actual: The output becomes 99, the action’s optimistic guess.
Platform
- Solid:
solid-js/@solidjs/webnext at3086f1b77cd7b0431d3a7f768c2984c335758633; comparison2.0.0-rc.13. Signals, compiler and diagnostics match the selected Solid build. - OS: macOS 26.6.2 (25G83); browser cases: system Google Chrome 155.0.8059.40. Server-only/type checks run in Bun 1.4.2.
- Builds/comparison: development and production fail. rc.13 passes in both builds.
Additional context
Refresh requests authoritative data; the caller's optimistic overlay must not become that authoritative result.
Full automated reproduction
One-command setup, run and expected output.
Copy the standalone files into a fresh Bun project. The displayed snippet is executed by snippet.test.ts. The original automated case is also retained.
bun init -y
bun add [email protected] @solidjs/[email protected] @solidjs/[email protected] @solidjs/[email protected] @solidjs/[email protected]
bun add -d playwright
bun run link-head.ts /absolute/path/to/built/solid
BUILD_MODE=development bun test ./snippet.test.ts
The five linked packages must come from the same built HEAD checkout. Omitting the link step selects the rc.13 comparison. Chrome runs use the system installation.
- Ngôn ngữ chính
- TypeScript
- Star
- 36.1k
- Fork
- 1.1k
- Merge trung bình
- 11 giờ 42 phút
- Pull request đã merge (30 ngày)
- 326
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
-
[2.0 next, regressed after rc.13] Async-generator action times out on its authoritative live echoĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày 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
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/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 84/100
answerLoops/answerLoops#345 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
siyuan-note/siyuan#20313 ·
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
LanternOps/breeze#8254 ·
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 82/100
gofish-graphics/gofish-graphics#1084 ·
Maintainer thường phản hồi trong vòng 1 ngày