@koordinates/xstate-tree 5.1.0-next.3 → 5.1.0-next.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.
|
@@ -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 ?? {}) };
|
|
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.toJSON = exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.
|
|
3
|
+
exports.toJSON = 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
|
@@ -318,7 +318,7 @@ function buildRootComponent(machine, routing) {
|
|
|
318
318
|
const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
|
|
319
319
|
const initialMeta = {
|
|
320
320
|
...(routing.history.location.state?.meta ?? {}),
|
|
321
|
-
onloadEvent:
|
|
321
|
+
onloadEvent: true,
|
|
322
322
|
};
|
|
323
323
|
const queryString = getQueryString();
|
|
324
324
|
const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
|
package/package.json
CHANGED