@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 +8 -3
- package/package.json +1 -1
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 =
|
|
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(),
|
|
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