Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 21 Mar 03:56
· 3381 commits to main since this release
2236b9f

Minor Changes

  • 9f6a6e9e #1991 Thanks @santicros! - Added new useActor, which is a composable that subscribes to emitted changes from an existing actor:

    import { useActor } from '@xstate/vue';
    
    export default defineComponent({
      props: ['someSpawnedActor'],
      setup(props) {
        const { state, send } = useActor(props.someSpawnedActor);
        return { state, send };
      }
    });
  • bfe42972 #1991 Thanks @santicros! - Fixed the UMD build by externalizing XState & Vue correctly.

  • 4346cabc #1991 Thanks @santicros! - Added new useInterpret, which is a low-level composable that interprets the machine and returns the service:

    import { useInterpret } from '@xstate/vue';
    import { someMachine } from '../path/to/someMachine';
    export default defineComponent({
      setup() {
        const state = ref();
        const service = useInterpret(machine, {}, nextState => {
          state.value = nextState.value;
        });
        return { service, state };
      }
    });
  • 012ef363 #1991 Thanks @santicros! - Added a proper ESM file using the"module" field in the package.json. It helps bundlers to automatically pick this over a file authored using CommonJS and allows them to apply some optimizations easier.