Interface: AmnesiaProviderProps
Defined in: provider.tsx:40
Props for AmnesiaProvider. Extends AmnesiaProviderOptions.
Extends
Readonly<AmnesiaProviderOptions>
Properties
capacity?
readonlyoptionalcapacity?:number
Defined in: types.ts:312
Maximum number of entries retained on the past stack. When the limit is reached, the oldest entry is dropped on every new push.
Defaults to 100. Set to Infinity to disable, but be aware closures
may retain large amounts of memory.
Inherited from
children
children:
ReactNode
Defined in: provider.tsx:42
Child tree that should share this history store.
coalesceWindowMs?
readonlyoptionalcoalesceWindowMs?:number
Defined in: types.ts:320
Maximum time (in milliseconds) between two pushes that share a
non-empty coalesceKey for them to merge into a single entry.
Defaults to 400.
Inherited from
AmnesiaStoreOptions.coalesceWindowMs
devToolsId?
optionaldevToolsId?:string
Defined in: provider.tsx:85
Stable id under which to register with the devtools registry. When
omitted, an auto-generated amnesia-N id is assigned on first mount
and reused across re-renders. Pin a known id if you want external
tooling to find the provider by name.
enableDevTools?
optionalenableDevTools?:boolean
Defined in: provider.tsx:77
Register the provider with the global devtools registry under
window.__REACT_AMNESIA_DEVTOOLS__. Off by default; opt in for
debugging, browser-extension integration, or AI-agent introspection.
The registry is lazy-installed: when no provider sets
enableDevTools={true} anywhere in the tree, no global is created.
metaTransform?
readonlyoptionalmetaTransform?: (meta) =>Record<string,unknown> |undefined
Defined in: types.ts:369
Sanitizer applied to meta before it is exposed in the public
snapshot or passed to lifecycle hooks. Use this to redact sensitive
fields without forcing every call site to remember the rule.
Only invoked when meta is defined. The return value replaces meta
in the public HistoryEntry; returning undefined strips it.
The transform should be pure and stable — it runs every time the snapshot is rebuilt and every time a hook is fired.
Parameters
| Parameter | Type |
|---|---|
meta | Record<string, unknown> |
Returns
Record<string, unknown> | undefined
Inherited from
AmnesiaStoreOptions.metaTransform
onAmend?
readonlyoptionalonAmend?: (entry,scopeId) =>void
Defined in: types.ts:401
Lifecycle hook fired after a successful amend on scopeId. The
entry is the updated top-of-past entry.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
Inherited from
Readonly.onAmend
onClear?
readonlyoptionalonClear?: (scopeId) =>void
Defined in: types.ts:420
Lifecycle hook fired after clear() on scopeId (and only when the
call actually cleared something). When the provider's clear()
clears all scopes, this fires once per cleared scope.
Parameters
| Parameter | Type |
|---|---|
scopeId | string |
Returns
void
Inherited from
Readonly.onClear
onError?
readonlyoptionalonError?:AmnesiaErrorHandler
Defined in: types.ts:326
Custom error reporter for failures inside redo / undo. See
AmnesiaErrorHandler.
Inherited from
onPush?
readonlyoptionalonPush?: (entry,scopeId) =>void
Defined in: types.ts:395
Lifecycle hook fired after a successful push commits a new entry to
the past stack of scopeId. Coalesce-merges do not fire this —
only the first push of a coalesce burst counts as a logical user
action.
Hook payloads are dispatched after the snapshot is updated and after subscribers have been notified, so handlers see a quiescent store. A throw inside the handler is caught and ignored.
The entry's meta (when present) has already been passed through
the scope's metaTransform.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
Inherited from
Readonly.onPush
onRedo?
readonlyoptionalonRedo?: (entry,scopeId) =>void
Defined in: types.ts:413
Lifecycle hook fired after a successful redo on scopeId. The
entry is the one that was moved from future to past.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
Inherited from
Readonly.onRedo
onUndo?
readonlyoptionalonUndo?: (entry,scopeId) =>void
Defined in: types.ts:407
Lifecycle hook fired after a successful undo on scopeId. The
entry is the one that was moved from past to future.
Parameters
| Parameter | Type |
|---|---|
entry | HistoryEntry |
scopeId | string |
Returns
void
Inherited from
Readonly.onUndo
scopes?
optionalscopes?:Record<string,ScopeOptions>
Defined in: provider.tsx:67
Per-scope option overrides keyed by scope id. Each entry merges over the provider-level defaults at scope-creation time. Settings are frozen once a scope is first accessed.
Example
<AmnesiaProvider scopes={{ canvas: { capacity: 1000 } }}>
...
</AmnesiaProvider>
store?
optionalstore?:Amnesia
Defined in: provider.tsx:53
Use a pre-built store as the default scope's backing instance instead of letting the provider create one. Other scopes are still created lazily on demand.
Useful for tests and for sharing a store with non-React code (e.g. a canvas controller). When supplied, this store keeps its capacity / coalesce settings.