[docs] SunsetPlace: Analysis, review, lessons, and G1.2 closed

This commit is contained in:
2026-11-02 00:01:53 +01:00
parent 85df2c43b5
commit 6d29e4a4c9
9 changed files with 228 additions and 8 deletions
+15
View File
@@ -35,3 +35,18 @@ condition that returns early hides every read after it.
**How to apply it.** In an effect, read the state you depend on before any early
return or `&&` (`const target = heading; if (moved) target?.focus();`). Test the
re-run, not just the first run.
## Svelte 5 state is a Proxy, and IndexedDB cannot clone a Proxy
**What happened.** On 2026-11-02 the sunset town was never saved in a real browser. The
search results lived in `$state`, which wraps objects in a Proxy. The town passed to
`save` was that Proxy, and IndexedDB's structured clone threw `DataCloneError`. Every
unit test passed. The e2e suite found it: after a reload, the garden asked again.
**Why it bit.** Anything that crosses a structured-clone boundary (IndexedDB,
`postMessage`, `BroadcastChannel`, `structuredClone`) refuses a Proxy, and Svelte 5
hands out Proxies wherever state is deep.
**How to apply it.** At every storage or messaging boundary, write a plain copy built
field by field (in `@rosea/storage`, the same shape check used on reading). Keep lists
that are only passed along as `$state.raw`. Test the boundary with `new Proxy(value, {})`.