Repository navigation
Commit 4f14a34
* fix(server): handle rejection in lazy() so it reaches Errored (closes #2780)
`load()` registered a single `p.then(mod => p.v = mod.default)`. When
the lazy import rejects, there's no second argument, so the rejection
falls through as a process-level `unhandledRejection` and `p.v` stays
`undefined` forever — the memo body keeps throwing `NotReadyError` and
SSR treats the module as still loading instead of converting the
rejection into a regular error that `<Errored>` can catch.
Add a rejection branch that stores the error on `p.error`, then surface
it from the memo via `if (p.error) throw p.error` ahead of the
`!p.v` NotReadyError check. Mirror the change on the `ctx.block(p.then(...))`
call site so it doesn't propagate its own unhandled rejection alongside
the one captured for the render path.
* test(server): cover rejected SSR lazy() reaching Errored + add changeset (#2780)
Adds the regression test the PR was missing. The original attempt asserted
the <Errored> fallback rendered into the server HTML, but in the streamed
case (rejected lazy under a Loading boundary) the server only serializes the
error at the boundary id and the client renders the fallback via the existing
streamed-fragment hydration path. The test asserts the correct server-side
behavior: the rejection is captured/serialized and the render completes
instead of hanging on NotReadyError or leaking an unhandledRejection.
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Ryan Carniato <[email protected]>
Co-authored-by: Cursor <[email protected]>
1 parent c943c5c commit 4f14a34
3 files changed
Lines changed: 61 additions & 7 deletions
File tree
- .changeset
- packages
- solid-web/test/server
- solid/src/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
269 | 300 | | |
270 | 301 | | |
271 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
90 | 100 | | |
91 | 101 | | |
92 | 102 | | |
| |||
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
124 | | - | |
125 | | - | |
126 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
130 | 147 | | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
| |||
0 commit comments