[2.0 rc.20 / next] A value that fails to serialize stays pending on the client while the render reports completion
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
- 35/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
- backend
Hướng nghiên cứu
Start with the default serializer's onError in packages/web/src/server.ts (around L2532), where a serialization failure is only reported. Run the included repro.mjs to see completedAll: true with the key left pending. Done means either the render fails like a rejection, or the key is settled as a rejection that <Errored> can catch, and onCompleteAll no longer fires while a key is unsettled. The choice between those two behaviours is a design decision for maintainers, so confirm it before writing code.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In #4242, the value that fails to serialize was noted as still not resolving, as a separate problem. This is that problem on its own, since I couldn't find an issue for it.
When the default serializer cannot serialize a resolved async value, the error reaches the error hook with handling: "serialize", the render completes and onCompleteAll runs. The hydration payload declares the promise for that key but never settles it, so the client waits for it forever: nothing hydrates past it, and there is no rejection for an <Errored> to catch.
A rejected async value in the same spot fails the render instead: the promise form resolves with no HTML and onCompleteAll is not called. So the server reports a broken document as a successful one only in the serialization case.
Versions
solid-js and @solidjs/web 2.0.0-rc.20 from npm, and next at ab29345. Node 26.13.0.
Reproduction
Save as repro.mjs in a project with solid-js and @solidjs/web 2.0.0-rc.20, then run node repro.mjs:
import { renderToStream, ssr, escape } from "@solidjs/web";
import { createMemo } from "solid-js";
class Unserializable {}
function App() {
const value = createMemo(() => Promise.resolve(new Unserializable()));
return ssr(["<main>", "</main>"], () => escape(String(value() instanceof Unserializable)));
}
let completedAll = false;
const errors = [];
const html = await renderToStream(App, {
onCompleteAll: () => (completedAll = true),
onError: error => errors.push(error?.constructor?.name)
});
console.log(html);
console.log({ completedAll, errors });
Observed
<main>true</main><script>(self.$R=self.$R||{})[""]=[];_$HY.r["0"]=$R[0]=($R[1]=($R[2]=() => {
const resolver = {
p: 0,
s: 0,
f: 0
};
resolver.p = new Promise((resolve, reject) => {
resolver.s = resolve;
resolver.f = reject;
});
return resolver;
})()).p;</script>
{ completedAll: true, errors: [ 'SerovalUnsupportedTypeError' ] }
$R[1] is never settled. With a serializable value, the payload ends with the call that resolves it (($R[3]=(resolver, data) => {...})($R[1],"loaded")). With Promise.reject(new Error("...")) instead, the output is an empty document and { completedAll: false, errors: [ 'Error' ] }.
Expected
A value that cannot be serialized is handled like a failure of that value: either the render fails the same way it does for a rejection, or the key reaches the client as a rejection that the nearest <Errored> can handle. In both cases onCompleteAll should not report the document as complete while one of its keys can never settle.
Cause
The default serializer's onError only reports the failure (packages/web/src/server.ts, L2532 on next). Nothing fails the render or writes a settle call for the key, and the render then completes through the normal path.
- Ngôn ngữ chính
- TypeScript
- Star
- 36.2k
- Fork
- 1.1k
- Merge trung bình
- 9 giờ 56 phút
- Pull request đã merge (30 ngày)
- 487
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ó 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 45/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 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 22/100
Maintainer thường phản hồi trong vòng 1 ngày
-
What gets passed to the `when` prop of a `Show` still gets executed twice on SSRCó thể đã có người làm @brenelz đã nhận 5 ngày trước. Đang mở1.x
Độ khó 3/5 1-2 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ự
-
[fullsend] E2E: scorecard — filecheck GitLab entity metrics unavailable due to initialDelay timingĐang mởe2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redhat-developer/rhdh-plugin-export-overlays#4698 · 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 88/100
devswha/herdr-web-ui#2884 ·
-
Độ 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
-
b:minor bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
software-mansion/argent#1771 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Resources: New palettes of XiamenCó thể đã có người làm @rmt-svc đã nhận hôm nay. Đang mởresources
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
railmapgen/rmg-palette#2491 ·
Maintainer thường phản hồi trong vòng 4 ngày