@koordinates/xstate-tree 5.2.0 → 5.2.1
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.
|
@@ -102,12 +102,27 @@ function buildCreateRoute(history, basePath) {
|
|
|
102
102
|
let url = fullUrl;
|
|
103
103
|
const parentRoutes = getParentArray();
|
|
104
104
|
let params = {};
|
|
105
|
+
const parsedQuery = (0, query_string_1.parse)(search);
|
|
105
106
|
while (parentRoutes.length) {
|
|
106
107
|
const parentRoute = parentRoutes.shift();
|
|
107
108
|
const parentMatch = parentRoute.matcher(url, undefined);
|
|
108
109
|
if (parentMatch === false) {
|
|
109
110
|
return false;
|
|
110
111
|
}
|
|
112
|
+
// Evaluate parent's canMatch predicate if provided
|
|
113
|
+
if (parentRoute.canMatch) {
|
|
114
|
+
const accumulatedParams = {
|
|
115
|
+
...params,
|
|
116
|
+
...(parentMatch.params ?? {}),
|
|
117
|
+
};
|
|
118
|
+
const canMatchResult = parentRoute.canMatch({
|
|
119
|
+
params: accumulatedParams,
|
|
120
|
+
query: parsedQuery,
|
|
121
|
+
});
|
|
122
|
+
if (!canMatchResult) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
111
126
|
url = url.slice(parentMatch.matchLength);
|
|
112
127
|
// All routes assume the url starts with a /
|
|
113
128
|
// so if the parent route matches the / in the url, which consumes it
|
package/package.json
CHANGED