@koordinates/xstate-tree 4.3.0-beta.8 → 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
@@ -330,9 +330,12 @@ function buildRootComponent(machine, routing) {
330
330
  var _a, _b;
331
331
  if (routing) {
332
332
  const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
333
- const initialMeta = (_b = (_a = routing.history.location.state) === null || _a === void 0 ? void 0 : _a.meta) !== null && _b !== void 0 ? _b : {};
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
+ };
334
337
  const queryString = getQueryString();
335
- const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), { ...initialMeta, onloadEvent: (0, utils_1.isLikelyPageLoad)() });
338
+ const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
336
339
  if (result) {
337
340
  setActiveRouteEvents(result.events);
338
341
  setActiveRoute({ ...result.matchedRoute });
@@ -340,7 +343,9 @@ function buildRootComponent(machine, routing) {
340
343
  // Hack to ensure the initial location doesn't have undefined state
341
344
  // It's not supposed to, but it does for some reason
342
345
  // And the history library ignores popstate events with undefined state
343
- routing.history.replace(`${getPathName()}${queryString}`, {});
346
+ routing.history.replace(`${getPathName()}${queryString}`, {
347
+ meta: initialMeta,
348
+ });
344
349
  }
345
350
  }, []);
346
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.8",
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": [