@koordinates/xstate-tree 4.3.0-beta.7 → 4.3.0-beta.9

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/xstateTree.js CHANGED
@@ -327,10 +327,15 @@ function buildRootComponent(machine, routing) {
327
327
  };
328
328
  }, [activeRoute]);
329
329
  (0, react_2.useEffect)(() => {
330
+ var _a, _b;
330
331
  if (routing) {
331
332
  const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
333
+ const initialMeta = {
334
+ ...((_b = (_a = routing.history.location.state) === null || _a === void 0 ? void 0 : _a.meta) !== null && _b !== void 0 ? _b : {}),
335
+ onloadEvent: (0, utils_1.isLikelyPageLoad)(),
336
+ };
332
337
  const queryString = getQueryString();
333
- const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), { onloadEvent: (0, utils_1.isLikelyPageLoad)() });
338
+ const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
334
339
  if (result) {
335
340
  setActiveRouteEvents(result.events);
336
341
  setActiveRoute({ ...result.matchedRoute });
@@ -338,7 +343,9 @@ function buildRootComponent(machine, routing) {
338
343
  // Hack to ensure the initial location doesn't have undefined state
339
344
  // It's not supposed to, but it does for some reason
340
345
  // And the history library ignores popstate events with undefined state
341
- routing.history.replace(`${getPathName()}${queryString}`, {});
346
+ routing.history.replace(`${getPathName()}${queryString}`, {
347
+ meta: initialMeta,
348
+ });
342
349
  }
343
350
  }, []);
344
351
  (0, react_2.useEffect)(() => {
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.3.0-beta.7",
5
+ "version": "4.3.0-beta.9",
6
6
  "license": "MIT",
7
7
  "description": "Build UIs with Actors using xstate and React",
8
8
  "keywords": [