Interface: AmnesiaState
Defined in: types.ts:149
Snapshot of the store consumed by useSyncExternalStore.
Snapshots are referentially stable until the next mutation, so
useSyncExternalStore does not tear and React's re-render bailout
remains effective.
Extended by
Properties
canRedo
readonlycanRedo:boolean
Defined in: types.ts:165
Convenience flag — equivalent to future.length > 0.
canUndo
readonlycanUndo:boolean
Defined in: types.ts:162
Convenience flag — equivalent to past.length > 0.
epoch
readonlyepoch:number
Defined in: types.ts:185
Monotonic counter that bumps only on clear() and provider unmount
(dispose()). Unlike version, incidental pushes / undos / redos do
not advance it.
Used internally by async operations as an abort token: an in-flight
await whose epoch snapshot disagrees with the current value resolves
to a stale-drop and is reported via onError({ phase: "stale" }).
Application code can also subscribe to epoch to detect "the document
changed underneath me" without re-rendering on every keystroke.
future
readonlyfuture: readonlyHistoryEntry[]
Defined in: types.ts:159
Entries available to redo(), with the next-redo entry at the end.
past
readonlypast: readonlyHistoryEntry[]
Defined in: types.ts:154
Entries available to undo(), oldest at index 0 and newest at the
end. Same ordering as a typical "history list" UI.
pending
readonlypending:boolean
Defined in: types.ts:195
true while at least one push / undo / redo has an unresolved
Promise in flight. Synchronous handlers complete before any subscriber
observes pending: true.
Concurrent calls while pending === true resolve to null immediately
and are reported via onError({ phase: "busy" }).
version
readonlyversion:number
Defined in: types.ts:171
Monotonic version counter incremented on every mutation. Useful for
cache keys or useEffect dependency arrays.