xstate icon indicating copy to clipboard operation
xstate copied to clipboard

CreateActor Requires Input with Snapshot

Open thriftb opened this issue 1 year ago • 1 comments

Bug or feature request?

Bug

Description:

When creating an actor with a snapshot (createActor, restoring a persistent state), it requires an Input. Input shouldn't be necessary when creating an actor from a snapshot.

(Bug) Expected result:

Create an actor from a snapshot (without needing an input).

(Bug) Actual result:

Input is required when creating an actor from a snapshot. It will result in an error if no input is provided.

(Bug) Potential fix:

Make Input required only if a snapshot isn't provided for createActor.

thriftb avatar May 29 '24 21:05 thriftb

you can do something like that, though omitting input altogether makes more sense

  createActor(machine, {
    snapshot: restoredState,
    input: undefined
  });

gsemyong avatar Apr 25 '25 13:04 gsemyong