statelyai/xstate
State machines, statecharts, and actors for complex logic
๐ Patch Changes
- [#5516](https://github.com/statelyai/xstate/pull/5516) [`41c0a5a`](https://github.com/statelyai/xstate/commit/41c0a5a2878713bde019c61099f9486fae2c70f8) Thanks [@joshuaellis](https://github.com/joshuaellis)! - fix(core): resolve children snapshot union pollution for typed invoke
๐ Minor Changes
- [#5530](https://github.com/statelyai/xstate/pull/5530) [`0502c04`](https://github.com/statelyai/xstate/commit/0502c041d0e7fd7826323f867e053e8f5422f59b) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Expose `store.schemas` so integrations can read the store's context, event, and emitted event schemas at runtime.
- ```ts
- const store = createStore({
- schemas: {
- context: z.object({ count: z.number() }),
- events: {
- inc: z.object({ by: z.number() })
- }
- + 8 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Export `InspectedTransitionEvent` from `xstate`.
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Remove `createStoreWithProducer`. Use `(ctx, ev) => produce(ctx, draft => โฆ)` in `createStore` event handlers instead.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Added `enq.trigger` for enqueueing store events from transitions.
- ```ts
- const store = createStore({
- schemas: {
- events: {
- inc: z.object({}),
- incTwice: z.object({})
- + 70 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Pass an `AbortSignal` to `createAsyncAtom(...)` getters and ignore stale async results after recomputation.
- ```ts
- const user = createAsyncAtom(async ({ signal }) => {
- const response = await fetch('/user', { signal });
- return response.json();
- });
- ```
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add reusable atom configs and framework atom-state helpers.
- + 41 more
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add reusable atom configs and framework atom-state helpers.
- ```ts
- const countConfig = createAtomConfig((input: { initialCount: number }) => {
- return input.initialCount;
- });
- function Counter() {
- const [count, countAtom] = useAtomState(countConfig, { initialCount: 0 });
- return (
- + 6 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add reusable atom configs and framework atom-state helpers.
- ```ts
- const countConfig = createAtomConfig((input: { initialCount: number }) => {
- return input.initialCount;
- });
- function Counter() {
- const [count, countAtom] = useAtomState(countConfig, { initialCount: 0 });
- return (
- + 6 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add reusable atom configs and framework atom-state helpers.
- ```ts
- const countConfig = createAtomConfig((input: { initialCount: number }) => {
- return input.initialCount;
- });
- function Counter() {
- const [count, countAtom] = useAtomState(countConfig, { initialCount: 0 });
- return (
- + 6 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Minor Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add reusable atom configs and framework atom-state helpers.
- ```ts
- const countConfig = createAtomConfig((input: { initialCount: number }) => {
- return input.initialCount;
- });
- function Counter() {
- const [count, countAtom] = useAtomState(countConfig, { initialCount: 0 });
- return (
- + 6 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Major Changes
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Modernize Store v4 package entrypoints.
- [#5512](https://github.com/statelyai/xstate/pull/5512) [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createStoreLogic(...)` for reusable store definitions, and support creating stores from logic in framework hooks.
- ```ts
- const counterLogic = createStoreLogic({
- context: (input: { initialCount: number }) => ({
- count: input.initialCount
- }),
- on: {
- + 10 more
๐ Patch Changes
- Updated dependencies \[[`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69), [`063416d`](https://github.com/statelyai/xstate/commit/063416db859581b91fd661ae1a89b75a37fffa69)]:
- @xstate/store@4.0.0
๐ Patch Changes
- [#5525](https://github.com/statelyai/xstate/pull/5525) [`f79ea13`](https://github.com/statelyai/xstate/commit/f79ea13febe44956d309811a64b9b79f4f3d9295) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Fixed route transition guards so named guards registered with `setup({ guards })` are resolved for `route.guard`.
- ```ts
- const machine = setup({
- guards: {
- isReady: ({ context }) => context.ready
- }
- }).createMachine({
- states: {
- + 9 more
๐ Patch Changes
- [#5521](https://github.com/statelyai/xstate/pull/5521) [`c4bb9e3`](https://github.com/statelyai/xstate/commit/c4bb9e3878b7595479554a4ed5ab93b81295d472) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Fix broken exports caused by missing build step in the publish workflow.
๐ Patch Changes
- [#5518](https://github.com/statelyai/xstate/pull/5518) [`3a881f5`](https://github.com/statelyai/xstate/commit/3a881f5204cc874c242ec04ce3471110b9d8c506) Thanks [@thecrypticace](https://github.com/thecrypticace)! - Fix synchronous subscribe callbacks still not re-running if a subscription triggers another one through multiple levels of computed atoms.
๐ Patch Changes
- [#5513](https://github.com/statelyai/xstate/pull/5513) [`d15455b`](https://github.com/statelyai/xstate/commit/d15455b13c42a48ef139e1381cd3ee57e40defba) Thanks [@thecrypticace](https://github.com/thecrypticace)! - Fix computed `atom.subscribe()` callbacks not re-running after one of it's dependencies is synchronously updated inside the callback. Previously, calling `someDependency.set()` inside a subscription callback would prevent that subscription from being notified of future changes. This also affected store selector subscriptions which triggered an update to the store.
๐ Patch Changes
- [#5510](https://github.com/statelyai/xstate/pull/5510) [`d51fa6d`](https://github.com/statelyai/xstate/commit/d51fa6d640d3aac9e3424417b70f2d6f81466f78) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Fix `atom.subscribe()` callbacks tracking dependencies from `.get()` calls inside the callback (fixes #5509). Previously, calling `otherAtom.get()` inside a subscription callback would cause the callback to re-run whenever `otherAtom` changed, even if the subscribed atom's value didn't change.
๐ Minor Changes
- [#5429](https://github.com/statelyai/xstate/pull/5429) [`9d9c1fe`](https://github.com/statelyai/xstate/commit/9d9c1fe9df43936aa6ab43a4694645a6966ace12) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `mapState(snapshot, mapper)` to map a snapshot to values based on active state(s).
- ```ts
- import { mapState } from 'xstate';
- const results = mapState(snapshot, {
- states: {
- loading: { map: () => 'Loading...' },
- success: { map: (snap) => snap.context.data },
- error: { map: (snap) => snap.context.error.message }
- + 18 more
๐ Minor Changes
- [#5493](https://github.com/statelyai/xstate/pull/5493) [`871857d`](https://github.com/statelyai/xstate/commit/871857d730b7c333728da2b17bc36844697e8f88) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add a `filterEvents` option to `xstate/graph` traversal helpers and
- `createTestModel(...)` to control which events should be explored from each
- state.
- This makes it possible to opt into enabled-only traversal for machine snapshots,
- such as when you only want to explore events that currently pass guards:
- ```ts
- import { createTestModel } from 'xstate/graph';
- const model = createTestModel(machine);
- + 4 more
๐ Minor Changes
- [#5299](https://github.com/statelyai/xstate/pull/5299) [`ca8306f`](https://github.com/statelyai/xstate/commit/ca8306f865475fa0404c419730a24e3a5e392521) Thanks [@Uniqen](https://github.com/Uniqen)! - Add `actor.select(selector, equalityFn?)` method to derive a `Readable<TSelected>` from an actor's snapshot. The returned object has `.subscribe()` (only emits when the selected value changes, using `Object.is` by default) and `.get()` for synchronous access.
- ```ts
- const actor = createActor(machine);
- actor.start();
- const count = actor.select((snap) => snap.context.count);
- count.get(); // current value
- count.subscribe((value) => {
- console.log(value); // only fires when count changes
- + 2 more
๐ Patch Changes
- [#5486](https://github.com/statelyai/xstate/pull/5486) [`582e43a`](https://github.com/statelyai/xstate/commit/582e43ac57c935712fbed74d6769e78b721eb0f7) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Fix emitted events not firing on stores with extensions (`.with()`)
๐ Minor Changes
- [#5479](https://github.com/statelyai/xstate/pull/5479) [`3b8c68e`](https://github.com/statelyai/xstate/commit/3b8c68e20057885f19b8897f4b4cb29380e8f7de) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `strategy: 'event'` option to the `persist` extension. Instead of persisting context snapshots, this persists the event log and replays events on rehydration to reconstruct state. When `maxEvents` is set, a snapshot checkpoint is automatically saved so that replay starts from the checkpoint rather than initial context, preserving correctness.
- Also adds `isHydrated(store)` helper to check hydration status.
- ```ts
- const store = createStore({
- context: { count: 0 },
- on: { inc: (ctx) => ({ count: ctx.count + 1 }) }
- }).with(
- persist({
- + 55 more
๐ Minor Changes
- [#5470](https://github.com/statelyai/xstate/pull/5470) [`3e03427`](https://github.com/statelyai/xstate/commit/3e03427639154a021c85e99e0518ab92cc42dc6d) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `useActor` and `useSelector` now throw when the actor reaches an error state, allowing errors to be caught by React error boundaries.
- ```tsx
- import { createMachine } from 'xstate';
- import { useActor } from '@xstate/react';
- import { ErrorBoundary } from 'react-error-boundary';
- const machine = createMachine({
- initial: 'idle',
- states: {
- + 31 more
๐ Minor Changes
- [#5467](https://github.com/statelyai/xstate/pull/5467) [`d54cc47`](https://github.com/statelyai/xstate/commit/d54cc4760513ba05e9c0fc7a4a783d0c47a882f2) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add wildcard `'*'` support for `store.on('*', โฆ)` to listen to all emitted events. The handler receives the union of all emitted event types.
- ```ts
- const store = createStore({
- context: { count: 0 },
- emits: {
- increased: (_: { upBy: number }) => {},
- decreased: (_: { downBy: number }) => {}
- },
- + 13 more
๐ Minor Changes
- [#4184](https://github.com/statelyai/xstate/pull/4184) [`a741fe7`](https://github.com/statelyai/xstate/commit/a741fe75901d3c4f08314e7c6d888bcb37866c04) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Added routable states. States with `route: {}` and an explicit `id` can be navigated to from anywhere via a single `{ type: 'xstate.route', to: '#id' }` event.
- ```ts
- const machine = setup({}).createMachine({
- id: 'app',
- initial: 'home',
- states: {
- home: { id: 'home', route: {} },
- dashboard: {
- + 21 more
๐ Patch Changes
- [#5464](https://github.com/statelyai/xstate/pull/5464) [`ad809a0`](https://github.com/statelyai/xstate/commit/ad809a0a7084f57a30a47aade90b83caa2eb65d9) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Fix: export types so setup() declaration emit works (fixes #5462)
๐ Minor Changes
- [#5457](https://github.com/statelyai/xstate/pull/5457) [`287b51e`](https://github.com/statelyai/xstate/commit/287b51eb80abc521f8c35fa73df177a0b9dfd3bc) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `getInitialMicrosteps(โฆ)` and `getMicrosteps(โฆ)` functions that return an array of `[snapshot, actions]` tuples for each microstep in a transition.
- ```ts
- import { createMachine, getInitialMicrosteps, getMicrosteps } from 'xstate';
- const machine = createMachine({
- initial: 'a',
- states: {
- a: {
- entry: () => console.log('enter a'),
- + 30 more
๐ Minor Changes
- [#5406](https://github.com/statelyai/xstate/pull/5406) [`703c3a1`](https://github.com/statelyai/xstate/commit/703c3a109c824f2334ede31d8428e923d2727e6e) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `getNextTransitions(state)` utility to get all transitions available from current `state`.
- ```ts
- import { getNextTransitions } from 'xstate';
- // ...
- const state = actor.getSnapshot();
- const transitions = getNextTransitions(state);
- transitions.forEach((t) => {
- console.log(`Event: ${t.eventType}, Source: ${t.source.key}`);
- + 2 more
๐ Minor Changes
- [#5452](https://github.com/statelyai/xstate/pull/5452) [`9992398`](https://github.com/statelyai/xstate/commit/9992398c2de922aff45804d8bfcbdc2a08594138) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Ensured that `compare` argument is a direct comparison function.
๐ Patch Changes
- [`d6498eb`](https://github.com/statelyai/xstate/commit/d6498eb8e98100e4977e036904a04714089571e4) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Added README.md
๐ Minor Changes
- [#5452](https://github.com/statelyai/xstate/pull/5452) [`9992398`](https://github.com/statelyai/xstate/commit/9992398c2de922aff45804d8bfcbdc2a08594138) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Ensured that `compare` argument is a direct comparison function.
๐ Patch Changes
- [`d6498eb`](https://github.com/statelyai/xstate/commit/d6498eb8e98100e4977e036904a04714089571e4) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Added README.md
๐ Patch Changes
- [`d6498eb`](https://github.com/statelyai/xstate/commit/d6498eb8e98100e4977e036904a04714089571e4) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Added README.md
