@tanstack/react-router 1.91.2 → 1.91.3
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/dist/cjs/router.cjs +28 -17
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +28 -17
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +34 -20
package/dist/cjs/router.cjs
CHANGED
|
@@ -1570,8 +1570,13 @@ ${script}\`)` : ""}; if (typeof __TSR__ !== 'undefined') __TSR__.cleanScripts()<
|
|
|
1570
1570
|
return;
|
|
1571
1571
|
});
|
|
1572
1572
|
const matches = [];
|
|
1573
|
+
const getParentContext = (parentMatch) => {
|
|
1574
|
+
const parentMatchId = parentMatch == null ? void 0 : parentMatch.id;
|
|
1575
|
+
const parentContext = !parentMatchId ? this.options.context ?? {} : parentMatch.context ?? this.options.context ?? {};
|
|
1576
|
+
return parentContext;
|
|
1577
|
+
};
|
|
1573
1578
|
matchedRoutes.forEach((route, index) => {
|
|
1574
|
-
var _a, _b, _c, _d
|
|
1579
|
+
var _a, _b, _c, _d;
|
|
1575
1580
|
const parentMatch = matches[index - 1];
|
|
1576
1581
|
const [preMatchSearch, searchError] = (() => {
|
|
1577
1582
|
const parentSearch = (parentMatch == null ? void 0 : parentMatch.search) ?? next.search;
|
|
@@ -1654,17 +1659,8 @@ ${script}\`)` : ""}; if (typeof __TSR__ !== 'undefined') __TSR__.cleanScripts()<
|
|
|
1654
1659
|
fullPath: route.fullPath
|
|
1655
1660
|
};
|
|
1656
1661
|
}
|
|
1657
|
-
const headFnContent = (_d = (_c = route.options).head) == null ? void 0 : _d.call(_c, {
|
|
1658
|
-
matches,
|
|
1659
|
-
match,
|
|
1660
|
-
params: match.params,
|
|
1661
|
-
loaderData: match.loaderData ?? void 0
|
|
1662
|
-
});
|
|
1663
|
-
match.links = headFnContent == null ? void 0 : headFnContent.links;
|
|
1664
|
-
match.scripts = headFnContent == null ? void 0 : headFnContent.scripts;
|
|
1665
|
-
match.meta = headFnContent == null ? void 0 : headFnContent.meta;
|
|
1666
1662
|
if (match.status === "success") {
|
|
1667
|
-
match.headers = (
|
|
1663
|
+
match.headers = (_d = (_c = route.options).headers) == null ? void 0 : _d.call(_c, {
|
|
1668
1664
|
loaderData: match.loaderData
|
|
1669
1665
|
});
|
|
1670
1666
|
}
|
|
@@ -1672,18 +1668,25 @@ ${script}\`)` : ""}; if (typeof __TSR__ !== 'undefined') __TSR__.cleanScripts()<
|
|
|
1672
1668
|
match.globalNotFound = globalNotFoundRouteId === route.id;
|
|
1673
1669
|
}
|
|
1674
1670
|
match.searchError = searchError;
|
|
1675
|
-
const
|
|
1676
|
-
const parentContext = !parentMatchId ? this.options.context ?? {} : parentMatch.context ?? this.options.context ?? {};
|
|
1671
|
+
const parentContext = getParentContext(parentMatch);
|
|
1677
1672
|
match.context = {
|
|
1678
1673
|
...parentContext,
|
|
1679
1674
|
...match.__routeContext,
|
|
1680
1675
|
...match.__beforeLoadContext
|
|
1681
1676
|
};
|
|
1677
|
+
matches.push(match);
|
|
1678
|
+
});
|
|
1679
|
+
matches.forEach((match, index) => {
|
|
1680
|
+
var _a, _b, _c, _d;
|
|
1681
|
+
const route = this.looseRoutesById[match.routeId];
|
|
1682
|
+
const existingMatch = this.getMatch(match.id);
|
|
1682
1683
|
if (!existingMatch && (opts == null ? void 0 : opts._buildLocation) !== true) {
|
|
1684
|
+
const parentMatch = matches[index - 1];
|
|
1685
|
+
const parentContext = getParentContext(parentMatch);
|
|
1683
1686
|
const contextFnContext = {
|
|
1684
|
-
deps: loaderDeps,
|
|
1687
|
+
deps: match.loaderDeps,
|
|
1685
1688
|
params: match.params,
|
|
1686
|
-
context:
|
|
1689
|
+
context: parentContext,
|
|
1687
1690
|
location: next,
|
|
1688
1691
|
navigate: (opts2) => this.navigate({ ...opts2, _fromLocation: next }),
|
|
1689
1692
|
buildLocation: this.buildLocation,
|
|
@@ -1692,14 +1695,22 @@ ${script}\`)` : ""}; if (typeof __TSR__ !== 'undefined') __TSR__.cleanScripts()<
|
|
|
1692
1695
|
preload: !!match.preload,
|
|
1693
1696
|
matches
|
|
1694
1697
|
};
|
|
1695
|
-
match.__routeContext = ((
|
|
1698
|
+
match.__routeContext = ((_b = (_a = route.options).context) == null ? void 0 : _b.call(_a, contextFnContext)) ?? {};
|
|
1696
1699
|
match.context = {
|
|
1697
1700
|
...parentContext,
|
|
1698
1701
|
...match.__routeContext,
|
|
1699
1702
|
...match.__beforeLoadContext
|
|
1700
1703
|
};
|
|
1701
1704
|
}
|
|
1702
|
-
|
|
1705
|
+
const headFnContent = (_d = (_c = route.options).head) == null ? void 0 : _d.call(_c, {
|
|
1706
|
+
matches,
|
|
1707
|
+
match,
|
|
1708
|
+
params: match.params,
|
|
1709
|
+
loaderData: match.loaderData ?? void 0
|
|
1710
|
+
});
|
|
1711
|
+
match.links = headFnContent == null ? void 0 : headFnContent.links;
|
|
1712
|
+
match.scripts = headFnContent == null ? void 0 : headFnContent.scripts;
|
|
1713
|
+
match.meta = headFnContent == null ? void 0 : headFnContent.meta;
|
|
1703
1714
|
});
|
|
1704
1715
|
return matches;
|
|
1705
1716
|
}
|