You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 97ac52c
Browse filesBrowse the repository at this point in the historyBrowse files
feat(router): createLocationState can reject an older stored shape
The slot key is the file path and export name, so it survives a deploy
that changes the value's shape. A tab that stays open then restores
the old value typed as the new one. version stores { v, value } and a
missing or different v reads as undefined. validate checks the value
on read and a failure reads as undefined too.
Closes#994.
Copy file name to clipboardExpand all lines: packages/rangojs-router/docs/internal/feature-map.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -533,7 +533,7 @@ Server action execution pipeline, `useAction()` state tracking, action ID extrac
533
533
534
534
### Location State
535
535
536
-
-`createLocationState()` -- typed state definitions; each definition exposes `.read()`, `.write()`, and `.delete()` for static (non-reactive) access to its slot in `history.state`
536
+
-`createLocationState()` -- typed state definitions; each definition exposes `.read()`, `.write()`, and `.delete()` for static (non-reactive) access to its slot in `history.state`. `LocationStateOptions` is `{ flash?, version?, validate? }` (`LocationStateValidate<TState>` is `(value: unknown) => value is TState`). `version` stores `{ v, value }` and a missing or different `v` reads as `undefined` (the key is stable across deploys, so an old tab must not see the new shape). `validate` runs on read; `false` reads as `undefined`. Together, a version mismatch does not call `validate`. Neither option keeps the raw slot.
537
537
-`useLocationState()` -- reactive hook; updates on popstate / `__rsc_locationstate` (does NOT update on static `.write()` / `.delete()`)
538
538
-`redirect()` integration with location state
539
539
- Serializability check: `ValidateLocationState<T>` rejects values `history.state` cannot structured-clone; the `LocationStateUnsafe<reason, path>` brand names each failing field (`items[].info.values`; an object's own unsafe fields first, so a DOM node stops at its methods; depth-bounded at 8)
0 commit comments