@tanstack/react-router 1.94.0 → 1.95.0
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/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/router.cjs +8 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/useCanGoBack.cjs +8 -0
- package/dist/cjs/useCanGoBack.cjs.map +1 -0
- package/dist/cjs/useCanGoBack.d.cts +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/router.js +8 -1
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/useCanGoBack.d.ts +1 -0
- package/dist/esm/useCanGoBack.js +8 -0
- package/dist/esm/useCanGoBack.js.map +1 -0
- package/package.json +2 -2
- package/src/index.tsx +2 -0
- package/src/router.ts +8 -1
- package/src/useCanGoBack.ts +5 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ const useRouteContext = require("./useRouteContext.cjs");
|
|
|
36
36
|
const useRouter = require("./useRouter.cjs");
|
|
37
37
|
const useRouterState = require("./useRouterState.cjs");
|
|
38
38
|
const useLocation = require("./useLocation.cjs");
|
|
39
|
+
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
39
40
|
const utils = require("./utils.cjs");
|
|
40
41
|
const notFound = require("./not-found.cjs");
|
|
41
42
|
const searchMiddleware = require("./searchMiddleware.cjs");
|
|
@@ -145,6 +146,7 @@ exports.useRouteContext = useRouteContext.useRouteContext;
|
|
|
145
146
|
exports.useRouter = useRouter.useRouter;
|
|
146
147
|
exports.useRouterState = useRouterState.useRouterState;
|
|
147
148
|
exports.useLocation = useLocation.useLocation;
|
|
149
|
+
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
148
150
|
exports.createControlledPromise = utils.createControlledPromise;
|
|
149
151
|
exports.deepEqual = utils.deepEqual;
|
|
150
152
|
exports.escapeJSON = utils.escapeJSON;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -54,6 +54,7 @@ export { useRouteContext } from './useRouteContext.cjs';
|
|
|
54
54
|
export { useRouter } from './useRouter.cjs';
|
|
55
55
|
export { useRouterState } from './useRouterState.cjs';
|
|
56
56
|
export { useLocation } from './useLocation.cjs';
|
|
57
|
+
export { useCanGoBack } from './useCanGoBack.cjs';
|
|
57
58
|
export { escapeJSON, // SSR
|
|
58
59
|
useLayoutEffect, // SSR
|
|
59
60
|
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils.cjs';
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -580,7 +580,10 @@ class Router {
|
|
|
580
580
|
...rest
|
|
581
581
|
} = {}) => {
|
|
582
582
|
if (href) {
|
|
583
|
-
const
|
|
583
|
+
const currentIndex = this.history.location.state.__TSR_index;
|
|
584
|
+
const parsed = history.parseHref(href, {
|
|
585
|
+
__TSR_index: replace ? currentIndex : currentIndex + 1
|
|
586
|
+
});
|
|
584
587
|
rest.to = parsed.pathname;
|
|
585
588
|
rest.search = this.options.parseSearch(parsed.search);
|
|
586
589
|
rest.hash = parsed.hash.slice(1);
|
|
@@ -1009,6 +1012,10 @@ class Router {
|
|
|
1009
1012
|
let loaderIsRunningAsync = false;
|
|
1010
1013
|
if (prevLoaderPromise) {
|
|
1011
1014
|
await prevLoaderPromise;
|
|
1015
|
+
const match = this.getMatch(matchId);
|
|
1016
|
+
if (match.error) {
|
|
1017
|
+
handleRedirectAndNotFound(match, match.error);
|
|
1018
|
+
}
|
|
1012
1019
|
} else {
|
|
1013
1020
|
const parentMatchPromise = matchPromises[index - 1];
|
|
1014
1021
|
const route = this.looseRoutesById[routeId];
|