@xstate/react 7.0.0-alpha.4 → 7.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,6 @@ export declare function createActorContext<TLogic extends AnyActorLogic>(actorLo
6
6
  Provider: (props: {
7
7
  children: React.ReactNode;
8
8
  options?: ActorOptions<TLogic>;
9
- /** @deprecated Use `logic` instead. */
10
- machine?: never;
11
9
  logic?: TLogic;
12
10
  }) => React.ReactElement<any, any>;
13
11
  };
@@ -97,7 +97,7 @@ function useActorRef(machine, ...[options, observerOrListener]) {
97
97
  if (!observerOrListener) {
98
98
  return;
99
99
  }
100
- const sub = actorRef.subscribe(xstate.toObserver(observerOrListener));
100
+ const sub = actorRef.subscribe(xstate._toObserver(observerOrListener));
101
101
  return () => {
102
102
  sub.unsubscribe();
103
103
  };
@@ -139,12 +139,8 @@ function createActorContext(actorLogic, actorOptions) {
139
139
  function Provider({
140
140
  children,
141
141
  logic: providedLogic = actorLogic,
142
- machine,
143
142
  options: providedOptions
144
143
  }) {
145
- if (machine) {
146
- throw new Error(`The "machine" prop has been deprecated. Please use "logic" instead.`);
147
- }
148
144
  const actor = useActorRef(providedLogic, {
149
145
  ...actorOptions,
150
146
  ...providedOptions
@@ -106,7 +106,7 @@ function useActorRef(machine, ...[options, observerOrListener]) {
106
106
  if (!observerOrListener) {
107
107
  return;
108
108
  }
109
- const sub = actorRef.subscribe(xstate.toObserver(observerOrListener));
109
+ const sub = actorRef.subscribe(xstate._toObserver(observerOrListener));
110
110
  return () => {
111
111
  sub.unsubscribe();
112
112
  };
@@ -148,12 +148,8 @@ function createActorContext(actorLogic, actorOptions) {
148
148
  function Provider({
149
149
  children,
150
150
  logic: providedLogic = actorLogic,
151
- machine,
152
151
  options: providedOptions
153
152
  }) {
154
- if (machine) {
155
- throw new Error(`The "machine" prop has been deprecated. Please use "logic" instead.`);
156
- }
157
153
  const actor = useActorRef(providedLogic, {
158
154
  ...actorOptions,
159
155
  ...providedOptions
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useEffect, useState, useMemo, useRef, useCallback } from 'react';
3
3
  import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';
4
- import { toObserver, createActor, _hotSwapActorLogic } from 'xstate';
4
+ import { _toObserver, createActor, _hotSwapActorLogic } from 'xstate';
5
5
  import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';
6
6
  import { useSyncExternalStore } from 'use-sync-external-store/shim';
7
7
 
@@ -80,7 +80,7 @@ function useActorRef(machine, ...[options, observerOrListener]) {
80
80
  if (!observerOrListener) {
81
81
  return;
82
82
  }
83
- const sub = actorRef.subscribe(toObserver(observerOrListener));
83
+ const sub = actorRef.subscribe(_toObserver(observerOrListener));
84
84
  return () => {
85
85
  sub.unsubscribe();
86
86
  };
@@ -122,12 +122,8 @@ function createActorContext(actorLogic, actorOptions) {
122
122
  function Provider({
123
123
  children,
124
124
  logic: providedLogic = actorLogic,
125
- machine,
126
125
  options: providedOptions
127
126
  }) {
128
- if (machine) {
129
- throw new Error(`The "machine" prop has been deprecated. Please use "logic" instead.`);
130
- }
131
127
  const actor = useActorRef(providedLogic, {
132
128
  ...actorOptions,
133
129
  ...providedOptions
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useEffect, useState, useMemo, useRef, useCallback } from 'react';
3
3
  import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';
4
- import { toObserver, createActor } from 'xstate';
4
+ import { _toObserver, createActor } from 'xstate';
5
5
  import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';
6
6
  import { useSyncExternalStore } from 'use-sync-external-store/shim';
7
7
 
@@ -71,7 +71,7 @@ function useActorRef(machine, ...[options, observerOrListener]) {
71
71
  if (!observerOrListener) {
72
72
  return;
73
73
  }
74
- const sub = actorRef.subscribe(toObserver(observerOrListener));
74
+ const sub = actorRef.subscribe(_toObserver(observerOrListener));
75
75
  return () => {
76
76
  sub.unsubscribe();
77
77
  };
@@ -113,12 +113,8 @@ function createActorContext(actorLogic, actorOptions) {
113
113
  function Provider({
114
114
  children,
115
115
  logic: providedLogic = actorLogic,
116
- machine,
117
116
  options: providedOptions
118
117
  }) {
119
- if (machine) {
120
- throw new Error(`The "machine" prop has been deprecated. Please use "logic" instead.`);
121
- }
122
118
  const actor = useActorRef(providedLogic, {
123
119
  ...actorOptions,
124
120
  ...providedOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xstate/react",
3
- "version": "7.0.0-alpha.4",
3
+ "version": "7.0.0-alpha.5",
4
4
  "description": "XState tools for React",
5
5
  "keywords": [
6
6
  "state",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
57
- "xstate": "^6.0.0-alpha.61"
57
+ "xstate": "^6.0.0-alpha.68"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "xstate": {
@@ -74,7 +74,7 @@
74
74
  "react-dom": "^19.0.0",
75
75
  "rxjs": "^7.8.1",
76
76
  "zod": "^3.25.51",
77
- "xstate": "^6.0.0-alpha.61"
77
+ "xstate": "^6.0.0-alpha.68"
78
78
  },
79
79
  "scripts": {}
80
80
  }