github statelyai/xstate @xstate/effect@0.1.0-alpha.5

pre-release3 hours ago

Patch Changes

  • 5228c00: Infer the current service requirements of actions and actors replaced with machine.provide. Require declared actor input in createActorAtoms, consistently with createEffectActor.

    Effect tasks and streams now release their resources when they complete, fail or are cancelled. Actor shutdown waits for task cleanup before releasing resources shared for the actor's lifetime. Use withActorScope around an acquisition to keep its resource until the owning Effect actor stops:

    import { Effect } from 'effect';
    import { withActorScope } from '@xstate/effect';
    
    const session = Effect.acquireRelease(
      Effect.succeed({ id: 'session' }),
      () => Effect.log('Session closed')
    ).pipe(withActorScope);

    Improve XState Effect guides with complete, tested workflow, stream, inspection and React examples.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.