mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
docs(CLAUDE.md,ARCHITECTURE.md): record snapshot-consumer rollback (e142efd)
CLAUDE.md updates:
- Patterns to use: "useSessionSnapshots" section retitled "(OPT-IN)";
the documented pilot adopters (useSessionInfo,
AvatarInfoWidgetAvatarView) are removed. Adds explicit warning about
the suspected useBetween + useSyncExternalStore + React Compiler
interaction and the rollback in e142efd.
- Adopted table: snapshot-consumer row changed to "No in-tree
consumers" with note about defensive fallbacks remaining.
- Not yet table: the useChatWidget reactive-ownUserId line corrected
to reflect the rollback; the "migrate session-data mirrors" row
marked BLOCKED with a retry hint (try a non-useBetween consumer
first to isolate the cause).
ARCHITECTURE.md update:
- useExternalSnapshot bullet in the "Solution" section gains a note
pointing at the 8 pre-built consumers in useSessionSnapshots.ts and
the 2026-05-18 rollback caveat with the suspected interaction and
retry guidance.
Pure documentation refresh; no code change. The useSessionSnapshots.ts
file and the vite alias remain in place — they're not what got rolled
back, only the consumer-side migrations were.
This commit is contained in:
+15
-1
@@ -103,7 +103,21 @@ information when forced into a single selector.
|
||||
`useSyncExternalStore` wrapper pairing the renderer's
|
||||
`EventDispatcher.subscribe()` with the `getXxxSnapshot()` getters
|
||||
added in renderer 2.1.0. Use this for readonly views over manager
|
||||
state (`getUserDataSnapshot`, `getActiveRoomSessionSnapshot`).
|
||||
state. Eight pre-built consumers live in
|
||||
`src/hooks/session/useSessionSnapshots.ts` (userData / activeRoomSession
|
||||
/ ignoredUsers / groupBadges / soundVolumes / roomUserList + scalar
|
||||
derivations `useIsUserIgnored`, `useGroupBadge`), each with defensive
|
||||
`typeof` guards against a stale renderer bundle.
|
||||
|
||||
**Note (2026-05-18):** the first three pilot migrations (`useSessionInfo`,
|
||||
`useChatWidget.ownUserId`, `AvatarInfoWidgetAvatarView` Ignore-menu)
|
||||
were rolled back in `e142efd` after a persistent runtime error
|
||||
`(intermediate value)() is undefined` at `ToolbarView.tsx:46` that
|
||||
the vite-alias fix (`790ad2b`) and defensive guards (`c35a2d4`) could
|
||||
not eliminate. Suspected interaction: `useBetween` +
|
||||
`useSyncExternalStore` + React Compiler. Before retrying any
|
||||
migration here, exercise the snapshot hooks from a non-`useBetween`
|
||||
consumer in a low-blast-radius widget first to isolate the cause.
|
||||
|
||||
For state owned outside the listener (the `useState` + `setState(prev =>
|
||||
applyX(prev, event))` pattern), keep using `useNitroEvent` /
|
||||
|
||||
Reference in New Issue
Block a user