Skip to content

Releases: VanTanev/xstate-helpers

v2.0.0

14 May 11:21
Compare
Choose a tag to compare

Bring the package in line with latest XState.

BREAKING CHANGES

This package now requires xstate>=4.30.0 and @xstate/react>=3.0.0

v1.2.0...v2.0.0-0

v1.2.0

11 Nov 17:07
Compare
Choose a tag to compare

Depricate useIsXStateTransitionAvailable() in favor of the new useStateCan(). It has the exact same API, but uses state.can(event) under the hood. Also, it saves you a render when use event objects in by using JSON.stringify(event) for React.useCallback() dependencies.

export function useStateCan<
  TEventType extends TEvent['type'],
  TEvent extends EventObject = EventObject,
>(
  service:
    | Interpreter<any, any, TEvent, any>
    | ActorRef<TEvent>,
  event: TEventType | TEvent,
): boolean {
  return useSelector<typeof service, boolean>(
    service,
    useCallback(
      state => state.can(event),
      // eslint-disable-next-line react-hooks/exhaustive-deps
      [service, JSON.stringify(event)],
    ),
  );
}

v1.1.0

09 Nov 09:03
Compare
Choose a tag to compare

New console method: XStateInspector.overrideOptions()

You can also override the inspector options from the console. For example, on some pages you might want the Inspector to run in a separate window:

// in the browser console
XStateInspector.overrideOptions({ iframe: false })

And then you can return to the default iframe behavior:

// in the browser console
XStateInspector.overrideOptions(undefined)

New prop options for <XStateInspectLoader>

Optional. Pass options into @xstate/inspect. For example:

import React from 'react';
import { XStateInspectLoader } from 'xstate-helpers/react/XStateInspectLoader';

const App = () => {
  return (
    <XStateInspectLoader options={{ url: 'https://statecharts.io/inspect', iframe: false }}>
      <YourComponents />
    </XStateInspectLoader>
  );
};

v1.0.6...v1.1.0

v1.0.6

31 Aug 10:58
Compare
Choose a tag to compare
  • Allow iframe styles to be overridden b94a1ea

v1.0.5...v1.0.6

v1.0.5

21 Aug 10:58
Compare
Choose a tag to compare
  • Remove nullish coalescing op because it breaks ESM in some babel setups e80bc6c

v1.0.4...v1.0.5

v1.0.4

19 Aug 18:07
Compare
Choose a tag to compare

v1.0.3...v1.0.4

v1.0.3

18 Aug 21:35
Compare
Choose a tag to compare
  • Handle deferred services in useIsXStateTransitionAvailable() 312622c

v1.0.2...v1.0.3

v1.0.1

06 Aug 15:06
Compare
Choose a tag to compare
  • Allow inspector options to be passed to <XStateInspectLoader> 6f8c39c

This allows you to use the new visualizer with <XStateInspectLoader>!

import React from 'react';
import { XStateInspectLoader } from 'xstate-helpers/react/XStateInspectLoader';

const App = () => {
  return (
    <XStateInspectLoader options={{ url: 'https://stately.ai/viz' }}>
      <YourComponents />
    </XStateInspectLoader>
  );
};

v1.0.0...v1.0.1

v1.0.1-1

06 Aug 14:28
Compare
Choose a tag to compare
v1.0.1-1 Pre-release
Pre-release
  • Allow inspector options to be passed to <XStateInspectLoader> 6f8c39c

v1.0.0...v1.0.1-1

v1.0.0

27 Jul 15:51
Compare
Choose a tag to compare
  • [Breaking change] Remove actorFromReducer and machineFromReducer - [email protected] behaviors handle this 15d53b3
  • [Breaking change] createReactContextHelpers() now returns useActor instead of useService 4355192
  • [Breaking change] Move to preconstruct, add multiple entry points d64e451

The most major change is that React helpers are no longer exported from the root of the package, instead you must import them from xstate-helpers/react. This change allows you to use xstate-helpers in projects that do not have react as a dependency.

v0.11.0...v1.0.0