@koordinates/xstate-tree 4.1.1 → 4.1.3
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.
- package/lib/testingUtilities.js +2 -1
- package/lib/xstate-tree.d.ts +1 -1
- package/lib/xstateTree.js +1 -2
- package/package.json +1 -1
package/lib/testingUtilities.js
CHANGED
|
@@ -77,7 +77,8 @@ export function buildTestRootComponent(machine, logger) {
|
|
|
77
77
|
if (!machine.meta) {
|
|
78
78
|
throw new Error("Root machine has no meta");
|
|
79
79
|
}
|
|
80
|
-
if (!machine.meta.view)
|
|
80
|
+
if ((machine.meta.builderVersion === 1 && !machine.meta.view) ||
|
|
81
|
+
(machine.meta.builderVersion === 2 && !machine.meta.View)) {
|
|
81
82
|
throw new Error("Root machine has no associated view");
|
|
82
83
|
}
|
|
83
84
|
const onChangeEmitter = new TinyEmitter();
|
package/lib/xstate-tree.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export declare function buildSelectors<TMachine extends AnyStateMachine, TSelect
|
|
|
202
202
|
*
|
|
203
203
|
* It also delays for 5ms to ensure any React re-rendering happens in response to the state transition
|
|
204
204
|
*/
|
|
205
|
-
export declare function buildTestRootComponent<TMachine extends AnyStateMachine, TSelectors extends AnySelector, TActions extends AnyActions, TContext = ContextFrom<TMachine>>(machine: StateMachine<TContext, XstateTreeMachineStateSchemaV1<TMachine, TSelectors, TActions>, EventFrom<TMachine>>, logger: typeof console.log): {
|
|
205
|
+
export declare function buildTestRootComponent<TMachine extends AnyStateMachine, TSelectors extends AnySelector, TActions extends AnyActions, TContext = ContextFrom<TMachine>>(machine: StateMachine<TContext, XstateTreeMachineStateSchemaV1<TMachine, TSelectors, TActions> | XstateTreeMachineStateSchemaV2<TMachine, TSelectors, TActions>, EventFrom<TMachine>>, logger: typeof console.log): {
|
|
206
206
|
rootComponent: () => JSX.Element | null;
|
|
207
207
|
addTransitionListener: (listener: () => void) => void;
|
|
208
208
|
awaitTransition(): Promise<void>;
|
package/lib/xstateTree.js
CHANGED
|
@@ -112,8 +112,7 @@ export function XstateTreeView({ interpreter }) {
|
|
|
112
112
|
const { slots: interpreterSlots } = interpreter.machine.meta;
|
|
113
113
|
const slots = useSlots(interpreter, interpreterSlots.map((x) => x.name));
|
|
114
114
|
const canHandleEvent = useCallback((e) => {
|
|
115
|
-
|
|
116
|
-
return (_a = interpreter.nextState(e).changed) !== null && _a !== void 0 ? _a : false;
|
|
115
|
+
return interpreter.getSnapshot().can(e);
|
|
117
116
|
}, [interpreter]);
|
|
118
117
|
const inState = useCallback((state) => {
|
|
119
118
|
var _a, _b;
|
package/package.json
CHANGED