statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.23k stars 1.26k forks source link

[core] Add `enqueue.sendParent(…)` #4981

Closed davidkpiano closed 4 months ago

davidkpiano commented 4 months ago

Added sendParent to the enqueueActions feature. This allows users to enqueue actions that send events to the parent actor within the enqueueActions block.

import { createMachine, enqueueActions } from 'xstate';

const childMachine = createMachine({
  entry: enqueueActions(({ enqueue }) => {
    enqueue.sendParent({ type: 'CHILD_READY' });
  })
});
changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: f46c226e3b791912e22ef825c6fa689e41b17f6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------ | ----- | | xstate | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR