MCPcopy
hub / github.com/statelyai/xstate / getSnapshot

Method getSnapshot

packages/core/src/createActor.ts:810–817  ·  view source on GitHub ↗

* Read an actor’s snapshot synchronously. * * @remarks * The snapshot represent an actor's last emitted value. * * When an actor receives an event, its internal state may change. An actor * may emit a snapshot when a state transition occurs. * * Note that some actors, such as

()

Source from the content-addressed store, hash-verified

808 * @see {@link Actor.getPersistedSnapshot} to persist the internal state of an actor (which is more than just a snapshot).
809 */
810 public getSnapshot(): SnapshotFrom<TLogic> {
811 if (isDevelopment && !this._snapshot) {
812 throw new Error(
813 `Snapshot can't be read while the actor initializes itself`
814 );
815 }
816 return this._snapshot;
817 }
818}
819
820export type RequiredActorOptionsKeys<TLogic extends AnyActorLogic> =

Callers 15

selectMethod · 0.95
ComponentFunction · 0.80
reset.test.tsFile · 0.80
types.test.tsxFile · 0.80
persist.test.tsFile · 0.80
validate.test.tsFile · 0.80
fromStore.test.tsFile · 0.80
broadcast.test.tsFile · 0.80
store.test.tsFile · 0.80
undo.test.tsFile · 0.80
clearStorageFunction · 0.80
flushStorageFunction · 0.80

Calls

no outgoing calls

Tested by 11

ComponentFunction · 0.64
runTestToCompletionFunction · 0.64
ComponentFunction · 0.64
ComponentFunction · 0.64
ChildTestFunction · 0.64
TestFunction · 0.64
DisplayFunction · 0.64
TestFunction · 0.64
AppFunction · 0.64
ComponentFunction · 0.64
ComponentFunction · 0.64