@koordinates/xstate-tree 4.1.0-beta.4 → 4.1.0-beta.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.
package/lib/builders.js CHANGED
@@ -122,7 +122,7 @@ export function createXStateTreeMachine(machine, options) {
122
122
  const xstateTreeMeta = {
123
123
  selectors,
124
124
  actions,
125
- view: options.view,
125
+ View: options.View,
126
126
  slots: (_c = options.slots) !== null && _c !== void 0 ? _c : [],
127
127
  };
128
128
  machine.meta = {
@@ -731,7 +731,7 @@ export declare type V2BuilderMeta<TMachine extends AnyStateMachine, TSelectorsOu
731
731
  selectors?: Selectors<TMachine, TSelectorsOutput>;
732
732
  actions?: Actions<TMachine, TSelectorsOutput, TActionsOutput>;
733
733
  slots?: TSlots;
734
- view: View<TActionsOutput, TSelectorsOutput, TSlots>;
734
+ View: View<TActionsOutput, TSelectorsOutput, TSlots>;
735
735
  };
736
736
 
737
737
  /**
package/lib/xstateTree.js CHANGED
@@ -165,7 +165,7 @@ export function XstateTreeView({ interpreter }) {
165
165
  const ViewV1 = interpreter.machine.meta.view;
166
166
  return (React.createElement(ViewV1, { selectors: selectorsRef.current, actions: actions, slots: slots, inState: inState }));
167
167
  case 2:
168
- const ViewV2 = interpreter.machine.meta.view;
168
+ const ViewV2 = interpreter.machine.meta.View;
169
169
  return (React.createElement(ViewV2, { selectors: selectorsRef.current, actions: actions, slots: slots }));
170
170
  default:
171
171
  throw new Error("builderVersion not set");
@@ -199,8 +199,17 @@ export function buildRootComponent(machine, routing) {
199
199
  if (!machine.meta) {
200
200
  throw new Error("Root machine has no meta");
201
201
  }
202
- if (!machine.meta.view) {
203
- throw new Error("Root machine has no associated view");
202
+ switch (machine.meta.builderVersion) {
203
+ case 1:
204
+ if (!machine.meta.view) {
205
+ throw new Error("Root machine has no associated view");
206
+ }
207
+ break;
208
+ case 2:
209
+ if (!machine.meta.View) {
210
+ throw new Error("Root machine has no associated view");
211
+ }
212
+ break;
204
213
  }
205
214
  const RootComponent = function XstateTreeRootComponent() {
206
215
  const [_, __, interpreter] = useMachine(machine, { devTools: true });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@koordinates/xstate-tree",
3
3
  "main": "lib/index.js",
4
4
  "types": "lib/xstate-tree.d.ts",
5
- "version": "4.1.0-beta.4",
5
+ "version": "4.1.0-beta.5",
6
6
  "license": "MIT",
7
7
  "description": "Build UIs with Actors using xstate and React",
8
8
  "keywords": [