github statelyai/xstate @xstate/svelte@6.0.0-alpha.4

pre-releaseone hour ago

Patch Changes

  • 5b6df81: xstate is now a required peer dependency of @xstate/react, @xstate/vue, @xstate/svelte, and @xstate/solid. Package managers now warn when xstate is missing instead of letting the adapter fail at runtime.

    useActorRef(), useActor(), and useMachine() in @xstate/react no longer write implementations provided on a later render onto the machine passed on the first render. A module-level machine shared by several components keeps its own implementations:

    const machine = createMachine({
      actions: { notify: () => {} },
      on: { DO: ({ actions }, enq) => enq(actions.notify) }
    });
    
    function Custom({ onNotify }) {
      // Only this component's actor uses `onNotify`.
      useActorRef(machine.provide({ actions: { notify: onNotify } }));
      return null;
    }
    
    function Plain() {
      // Still uses the original `notify`.
      useActorRef(machine);
      return null;
    }

Don't miss a new xstate release

NewReleases is sending notifications on new releases.