@xstate/react
Advanced tools
Comparing version 4.0.0-beta.9 to 4.0.0-beta.10
import { ActorRefFrom, AnyStateMachine, AreAllImplementationsAssumedToBeProvided, ActorOptions, MissingImplementationsError, StateFrom } from 'xstate'; | ||
/** | ||
* | ||
* @deprecated Use `useActor(...)` instead. | ||
* @alias useActor | ||
*/ | ||
@@ -6,0 +5,0 @@ export declare function useMachine<TMachine extends AnyStateMachine>(machine: AreAllImplementationsAssumedToBeProvided<TMachine['__TResolvedTypesMeta']> extends true ? TMachine : MissingImplementationsError<TMachine['__TResolvedTypesMeta']>, options?: ActorOptions<TMachine>): [ |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var useIsomorphicLayoutEffect = require('use-isomorphic-layout-effect'); | ||
require('xstate/actors'); | ||
var withSelector = require('use-sync-external-store/shim/with-selector'); | ||
@@ -181,4 +180,3 @@ | ||
/** | ||
* | ||
* @deprecated Use `useActor(...)` instead. | ||
* @alias useActor | ||
*/ | ||
@@ -185,0 +183,0 @@ function useMachine(machine, options = {}) { |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var useIsomorphicLayoutEffect = require('use-isomorphic-layout-effect'); | ||
var actors = require('xstate/actors'); | ||
var withSelector = require('use-sync-external-store/shim/with-selector'); | ||
@@ -86,3 +85,3 @@ | ||
function useActor(logic, options = {}) { | ||
if (actors.isActorRef(logic)) { | ||
if (!!logic && 'send' in logic && typeof logic.send === 'function') { | ||
throw new Error(`useActor() expects actor logic (e.g. a machine), but received an ActorRef. Use the useSelector(actorRef, ...) hook instead to read the ActorRef's snapshot.`); | ||
@@ -191,4 +190,3 @@ } | ||
/** | ||
* | ||
* @deprecated Use `useActor(...)` instead. | ||
* @alias useActor | ||
*/ | ||
@@ -195,0 +193,0 @@ function useMachine(machine, options = {}) { |
@@ -6,3 +6,2 @@ import * as React from 'react'; | ||
import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect'; | ||
import { isActorRef } from 'xstate/actors'; | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'; | ||
@@ -60,3 +59,3 @@ | ||
function useActor(logic, options = {}) { | ||
if (isActorRef(logic)) { | ||
if (!!logic && 'send' in logic && typeof logic.send === 'function') { | ||
throw new Error(`useActor() expects actor logic (e.g. a machine), but received an ActorRef. Use the useSelector(actorRef, ...) hook instead to read the ActorRef's snapshot.`); | ||
@@ -165,4 +164,3 @@ } | ||
/** | ||
* | ||
* @deprecated Use `useActor(...)` instead. | ||
* @alias useActor | ||
*/ | ||
@@ -169,0 +167,0 @@ function useMachine(machine, options = {}) { |
@@ -6,3 +6,2 @@ import * as React from 'react'; | ||
import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect'; | ||
import 'xstate/actors'; | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'; | ||
@@ -155,4 +154,3 @@ | ||
/** | ||
* | ||
* @deprecated Use `useActor(...)` instead. | ||
* @alias useActor | ||
*/ | ||
@@ -159,0 +157,0 @@ function useMachine(machine, options = {}) { |
{ | ||
"name": "@xstate/react", | ||
"version": "4.0.0-beta.9", | ||
"version": "4.0.0-beta.10", | ||
"description": "XState tools for React", | ||
@@ -58,3 +58,3 @@ "keywords": [ | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"xstate": "^5.0.0-beta.28" | ||
"xstate": "^5.0.0-beta.29" | ||
}, | ||
@@ -80,4 +80,4 @@ "peerDependenciesMeta": { | ||
"react-dom": "^18.0.0", | ||
"xstate": "5.0.0-beta.28" | ||
"xstate": "5.0.0-beta.29" | ||
} | ||
} |
31423
738