Skip to content

@xstate/effect@0.1.0-alpha.5

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:47
· 9 commits to main since this release
0ce0fdc

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.