@koordinates/xstate-tree 4.6.0 → 4.6.2

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.
@@ -9,7 +9,6 @@ const matchRoute_1 = require("../matchRoute");
9
9
  function handleLocationChange(routes, basePath, path, search, meta) {
10
10
  console.debug("[xstate-tree] Matching routes", basePath, path, search, meta);
11
11
  const match = (0, matchRoute_1.matchRoute)(routes, basePath, path, search);
12
- console.debug("[xstate-tree] Match result", match);
13
12
  if (match.type === "no-matches") {
14
13
  const fourOhFour = {
15
14
  type: "ROUTING_404",
@@ -24,6 +23,7 @@ function handleLocationChange(routes, basePath, path, search, meta) {
24
23
  return;
25
24
  }
26
25
  else {
26
+ console.log("[xstate-tree] matched route", match.event);
27
27
  const matchedEvent = match.event;
28
28
  matchedEvent.meta = { ...(meta !== null && meta !== void 0 ? meta : {}) };
29
29
  matchedEvent.meta.indexEvent = true;
package/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.isLikelyPageLoad = exports.assert = exports.assertIsDefined = exports.delay = void 0;
3
+ exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.assert = exports.assertIsDefined = exports.delay = void 0;
4
4
  function delay(ms = 0) {
5
5
  return new Promise((resolve) => setTimeout(resolve, ms));
6
6
  }
@@ -26,15 +26,6 @@ function assert(value, msg) {
26
26
  }
27
27
  }
28
28
  exports.assert = assert;
29
- function isLikelyPageLoad() {
30
- // without performance API, we can't tell if this is a page load
31
- if (typeof performance === "undefined") {
32
- return false;
33
- }
34
- // if it's been < 5 seconds since the page was loaded, it's probably a page load
35
- return performance.now() < 5000;
36
- }
37
- exports.isLikelyPageLoad = isLikelyPageLoad;
38
29
  function difference(a, b) {
39
30
  const result = {};
40
31
  for (const key in b) {
package/lib/xstateTree.js CHANGED
@@ -334,7 +334,7 @@ function buildRootComponent(machine, routing) {
334
334
  const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
335
335
  const initialMeta = {
336
336
  ...((_b = (_a = routing.history.location.state) === null || _a === void 0 ? void 0 : _a.meta) !== null && _b !== void 0 ? _b : {}),
337
- onloadEvent: (0, utils_1.isLikelyPageLoad)(),
337
+ onloadEvent: true,
338
338
  };
339
339
  const queryString = getQueryString();
340
340
  const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
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.6.0",
5
+ "version": "4.6.2",
6
6
  "license": "MIT",
7
7
  "description": "Build UIs with Actors using xstate and React",
8
8
  "keywords": [