Major Changes
-
#898
26986f417
Thanks @davidkpiano! - Sending a string event toactor.send('some string')
will now throw a proper error message. -
#3957
423c5ab72
Thanks @davidkpiano! - The machine.schema
property is now.types
:const machine = createMachine({ // schema: { ... } types: {} as { context: { ... }; events: { ... }; // ... } });
And the
.tsTypes
property is now.types.typegen
:const machine = createMachine({ // tsTypes: { ... } types: {} as { typegen: {}; context: { ... }; events: { ... }; // ... } });
-
#3968
eecb31b8f
Thanks @davidkpiano! - ThecreateEmptyActor()
function has been added to make it easier to create actors that do nothing ("empty" actors). This is useful for testing, or for some integrations such asuseActor(actor)
in@xstate/react
that require an actor:import { createEmptyActor } from 'xstate'; const SomeComponent = (props) => { // props.actor may be undefined const [state, send] = useActor(props.actor ?? createEmptyActor()); // ... };
-
#3966
61db63bf4
Thanks @davidkpiano! - You can now import the following fromxstate
:import { // actions // sendTo (removed) pure, // interpret helpers waitFor, // actor functions fromPromise, fromObservable, fromCallback, fromEventObservable, fromTransition, // guard functions stateIn, not, and, or }
The
send
action was removed from exports; usesendTo(...)
orraise(...)
instead.
Patch Changes
- #3959
ead287257
Thanks @davidkpiano! - Unresolved promises will now be properly persisted. The current behavior is to restart a promise that is unresolved.