Skip to content

Commit 4d271cf

Browse files
authored
Merge branch 'next' into compiler-export-compile-style
2 parents 6e5a92c + fbd375d commit 4d271cf

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

‎documentation/solid-2.0/05-async-data.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,16 @@ The promise is safe to ignore — fire-and-forget `refresh()` is unchanged, and
357357
358358
Refresh granularity is the granularity of the _derive function_: there is no per-path refetch to re-run, so refresh a derived store by passing its root (`refresh(todos)`, not `refresh(todos.items[0])`) — that re-asks the whole projection, and reads through any nested node after the `await` are fresh. Inside actions, `yield refresh(x)` is the mutate-then-refetch sequencing primitive — see RFC 06.
359359
360+
Inside an action, call `refresh(x)` from the generator. It doesn't need a `yield` unless the action needs the fresh value. Don't call it after an `await`, including inside an async helper the action yields: that code runs outside the action's transaction, like any write there. Awaiting it there also hangs. The waiter waits for the action's commit, and the commit waits for the helper. So it works until `x` happens to re-run during the action, and then it hangs:
361+
362+
```js
363+
const like = action(function* () {
364+
setLikes(likes() + 1);
365+
yield saveLike(); // async helper: no refresh() inside it
366+
refresh(post); // in the generator; `yield refresh(post)` only to wait for the fresh value
367+
});
368+
```
369+
360370
#### `resource.mutate` → `createOptimisticStore` / `action`
361371
362372
In 1.x, `mutate` replaced the resource value wholesale. This had several problems: no granular updates (the entire list re-rendered), no reconciliation (identity lost on every mutation), and no protection against race conditions (concurrent mutations could clobber each other):

‎packages/signals/src/core/action.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ function inTransaction<T>(t: Transaction, q: number, fn: () => T): T {
8989
* yield until(() => todos.some(t => t.id === saved.id));
9090
* ```
9191
*
92+
* The same holds inside an async helper the action yields
93+
* (`yield (async () => { ... })()`): everything after its first `await` runs
94+
* outside the transaction. An `await refresh(x)` or `await until(...)` there
95+
* waits for this action's commit, which waits on the helper, so it hangs
96+
* whenever `x` re-ran during the action (#4263) and works otherwise. Call
97+
* `refresh(x)` in the generator once the helper returns; `yield` it only when
98+
* the action needs the fresh value.
99+
*
92100
* (For the same reason, don't call `flush()` inside an action body — it
93101
* cannot reveal the held writes and is refused.)
94102
*

‎scripts/size/floor-caps.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"minified": 53598
1313
},
1414
"page: base server components (hydrating + dynamic + frames + sf reference)": {
15-
"cap": "33.27 KB",
16-
"minified": 101526
15+
"cap": "33.36 KB",
16+
"minified": 101535
1717
},
1818
"page: live server components (base + live/GET + action + isPending/latest)": {
19-
"cap": "37.64 KB",
20-
"minified": 115136
19+
"cap": "37.72 KB",
20+
"minified": 115193
2121
},
2222
"server: floor (getRequestEvent + isServer)": {
2323
"cap": "1.34 KB",

‎scripts/size/scenarios.js‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5073,6 +5073,7 @@ module.exports = [
50735073
// Writable memo write clears its error without a torn read (#4110, 2026-10-20, over next @ 7014aca4, accepted by the maintainer): 33.18 -> 33.20 KB, recorded minified 101,384 -> 101,444 B, measured locally (linux) at 33,190 B brotli / 101,444 B minified (+60 B minified over the recorded size), which includes #4163's +9 B merged without re-recording: a write to an errored writable memo recovers it at commit and keeps the error shown until then, and clears an error a pass staged under the same hold. Correctness; matches CI's numbers.
50745074
// Verdict-mount lane provenance for nested first passes (#4166, 2026-10-20, over next @ 5a4b2e85): cap 33.20 KB unchanged, recorded minified 101,444 -> 101,429 B (-15 B), measured in CI at 33,170 B brotli. A module-local laneRoot carries the mount's lane through nested first passes, gated on the lane engine, so bundles without it shrink. Size-Exception accepted by the maintainer (2026-10-20). Cap at measured + 10 B rounded up to 0.01 KB, never lowered here; recorded minified = measured.
50755075
// Throwing cleanups no longer abort teardown (#4213, 2026-10-21, over next @ a2a5b6f8): 33.20 KB -> 33.27 KB, recorded minified 101,429 -> 101,526 B (+97 B), measured in CI at 33,255 B brotli. Every onCleanup and effect cleanup runs when one throws; the first error is rethrown by a root's dispose() or at the end of the flush. Size-Exception accepted by the maintainer (2026-10-21). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
5076+
// Bug-fix batch (2026-10-26, over next @ 95dd480f): frozen floor 33.27 -> 33.36 KB, recorded minified 101,526 -> 101,535 B (+9 B), measured in CI at 33,343 B brotli. Re-recorded with the live-page raise so later PRs measure against next; growth is the 2026-10-26 bug-fix batch (#4279 hydrated Errored, #4281, #4280, #4277, #4278; net of #4261 moveBefore). Size-Exception accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
50765077
limit: floorCaps["page: base server components (hydrating + dynamic + frames + sf reference)"],
50775078
capMinified:
50785079
floorMinified["page: base server components (hydrating + dynamic + frames + sf reference)"],
@@ -5415,6 +5416,7 @@ module.exports = [
54155416
// Verdict-mount lane provenance for nested first passes (#4166, 2026-10-20, over next @ 5a4b2e85): 37.48 KB -> 37.53 KB, recorded minified 114,982 -> 115,031 B (+49 B), measured in CI at 37,516 B brotli. A module-local laneRoot carries the mount's lane through nested first passes, gated on the lane engine, so bundles without it shrink. Size-Exception accepted by the maintainer (2026-10-20). Cap at measured + 10 B rounded up to 0.01 KB, never lowered here; recorded minified = measured.
54165417
// Throwing cleanups no longer abort teardown (#4213, 2026-10-21, over next @ a2a5b6f8): 37.53 KB (unchanged), recorded minified 115,031 -> 115,011 B (-20 B), measured in CI at 37,512 B brotli. Every onCleanup and effect cleanup runs when one throws; the first error is rethrown by a root's dispose() or at the end of the flush. Size-Exception accepted by the maintainer (2026-10-21). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
54175418
// Keyed optimistic guess folds a correction (D-34, #4210, 2026-10-21, re-measured over next @ db8241ce): frozen floor 37.53 -> 37.64 KB, recorded minified 115,011 -> 115,136 B (+125 B: +110 B the lane engine's fold hooks, as `signals: + isPending/latest`, the rest brotli/mangle layout), measured locally (linux) at 37,627 B brotli. Size-Exception: the maintainer accepted the keyed-fold size cost (2026-10-22). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
5419+
// Bug-fix batch (2026-10-26, over next @ 95dd480f): frozen floor 37.64 -> 37.72 KB, recorded minified 115,136 -> 115,193 B (+57 B), measured in CI at 37,710 B brotli. Growth is the 2026-10-26 bug-fix batch: #4279 hydrated Errored runs its content in the hydration pass (+82 B minified), #4281 latest()-first throw (+51), #4280 derived store follows a memo's pending/errors (+15), #4277 outer boundary recovers after an inner rethrow (+11), #4278 per-key isPending (+11), net of #4261 moveBefore (-39) and layout. Size-Exception accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
54185420
limit: floorCaps["page: live server components (base + live/GET + action + isPending/latest)"],
54195421
capMinified:
54205422
floorMinified["page: live server components (base + live/GET + action + isPending/latest)"],
@@ -5574,8 +5576,9 @@ module.exports = [
55745576
// Writable memo write clears its error without a torn read (#4110, 2026-10-20, over next @ 7014aca4, accepted by the maintainer): 35.23 KB (unchanged), recorded minified 107,725 -> 107,785 B, measured locally (linux) at 35,212 B brotli / 107,785 B minified (+60 B minified over the recorded size), which includes #4163's +9 B merged without re-recording: a write to an errored writable memo recovers it at commit and keeps the error shown until then, and clears an error a pass staged under the same hold. Correctness; matches CI's numbers.
55755577
// Verdict-mount lane provenance for nested first passes (#4166, 2026-10-20, over next @ 5a4b2e85): 35.23 KB -> 35.30 KB, recorded minified 107,785 -> 107,770 B (-15 B), measured in CI at 35,285 B brotli. A module-local laneRoot carries the mount's lane through nested first passes, gated on the lane engine, so bundles without it shrink. Size-Exception accepted by the maintainer (2026-10-20). Cap at measured + 10 B rounded up to 0.01 KB, never lowered here; recorded minified = measured.
55765578
// Throwing cleanups no longer abort teardown (#4213, 2026-10-21, over next @ a2a5b6f8): 35.30 KB (unchanged), recorded minified 107,770 -> 107,876 B (+106 B), measured in CI at 35,271 B brotli. Every onCleanup and effect cleanup runs when one throws; the first error is rethrown by a root's dispose() or at the end of the flush. Size-Exception accepted by the maintainer (2026-10-21). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
5577-
limit: "35.30 KB",
5578-
capMinified: 107876,
5579+
// Bug-fix batch (2026-10-26, over next @ 95dd480f): 35.30 -> 35.34 KB, recorded minified 107,876 -> 107,894 B (+18 B), measured in CI at 35,322 B brotli. Re-recorded with the live-page raise; growth is the 2026-10-26 bug-fix batch (#4279 hydrated Errored, #4281, #4280, #4277, #4278; net of #4261 moveBefore). Accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
5580+
limit: "35.34 KB",
5581+
capMinified: 107894,
55795582
alias: pageAlias
55805583
},
55815584
{
@@ -5705,8 +5708,9 @@ module.exports = [
57055708
// Verdict-mount lane provenance for nested first passes (#4166, 2026-10-20, over next @ 5a4b2e85): 41.31 KB -> 41.42 KB, recorded minified 122,967 -> 123,015 B (+48 B), measured in CI at 41,410 B brotli. A module-local laneRoot carries the mount's lane through nested first passes, gated on the lane engine, so bundles without it shrink. Size-Exception accepted by the maintainer (2026-10-20). Cap at measured + 10 B rounded up to 0.01 KB, never lowered here; recorded minified = measured.
57065709
// Throwing cleanups no longer abort teardown (#4213, 2026-10-21, over next @ a2a5b6f8): 41.42 KB (unchanged), recorded minified 123,015 -> 123,010 B (-5 B), measured in CI at 41,403 B brotli. Every onCleanup and effect cleanup runs when one throws; the first error is rethrown by a root's dispose() or at the end of the flush. Size-Exception accepted by the maintainer (2026-10-21). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
57075710
// Keyed optimistic guess folds a correction (D-34, #4210, 2026-10-21, accepted by the maintainer 2026-10-22, re-measured over next @ db8241ce): 41.42 -> 41.47 KB, recorded minified 123,010 -> 123,120 B (+110 B: the page carries the lane engine's fold hooks, as `signals: + isPending/latest`), measured locally (linux) at 41,452 B brotli. Correctness. Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
5708-
limit: "41.47 KB",
5709-
capMinified: 123120,
5711+
// Bug-fix batch (2026-10-26, over next @ 95dd480f): 41.47 KB -> 41.56 KB, recorded minified 123,120 -> 123,192 B (+72 B), measured in CI at 41,547 B brotli. Same growth as the live floor: the 2026-10-26 bug-fix batch: #4279 hydrated Errored runs its content in the hydration pass (+82 B minified), #4281 latest()-first throw (+51), #4280 derived store follows a memo's pending/errors (+15), #4277 outer boundary recovers after an inner rethrow (+11), #4278 per-key isPending (+11), net of #4261 moveBefore (-39) and layout. Accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
5712+
limit: "41.56 KB",
5713+
capMinified: 123192,
57105714
alias: pageAlias
57115715
},
57125716
{
@@ -6082,8 +6086,9 @@ module.exports = [
60826086
// Verdict-mount lane provenance for nested first passes (#4166, 2026-10-20, over next @ 5a4b2e85): cap 46.91 KB unchanged, recorded minified 140,258 -> 140,296 B (+38 B), measured in CI at 46,884 B brotli. A module-local laneRoot carries the mount's lane through nested first passes, gated on the lane engine, so bundles without it shrink. Size-Exception accepted by the maintainer (2026-10-20). Cap at measured + 10 B rounded up to 0.01 KB, never lowered here; recorded minified = measured.
60836087
// Throwing cleanups no longer abort teardown (#4213, 2026-10-21, over next @ a2a5b6f8): 46.91 KB -> 46.96 KB, recorded minified 140,296 -> 140,292 B (-4 B), measured in CI at 46,942 B brotli. Every onCleanup and effect cleanup runs when one throws; the first error is rethrown by a root's dispose() or at the end of the flush. Size-Exception accepted by the maintainer (2026-10-21). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
60846088
// Keyed optimistic guess folds a correction (D-34, #4210, 2026-10-21, accepted by the maintainer 2026-10-22, re-measured over next @ db8241ce): 46.96 -> 47.01 KB, recorded minified 140,292 -> 140,402 B (+110 B: the page carries the lane engine's fold hooks, as `signals: + isPending/latest`), measured locally (linux) at 46,993 B brotli. Correctness. Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
6085-
limit: "47.01 KB",
6086-
capMinified: 140402,
6089+
// Bug-fix batch (2026-10-26, over next @ 95dd480f): 47.01 KB -> 47.11 KB, recorded minified 140,402 -> 140,456 B (+54 B), measured in CI at 47,099 B brotli. Same growth as the live floor: the 2026-10-26 bug-fix batch: #4279 hydrated Errored runs its content in the hydration pass (+82 B minified), #4281 latest()-first throw (+51), #4280 derived store follows a memo's pending/errors (+15), #4277 outer boundary recovers after an inner rethrow (+11), #4278 per-key isPending (+11), net of #4261 moveBefore (-39) and layout. Accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
6090+
limit: "47.11 KB",
6091+
capMinified: 140456,
60876092
alias: pageAlias,
60886093
conditions: solidConditions,
60896094
compile: { hydratable: true }

0 commit comments

Comments
 (0)