@tanstack/react-router 1.52.1 → 1.52.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/route.cjs +0 -17
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/router.cjs +4 -2
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/route.js +0 -17
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +4 -2
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/route.ts +8 -8
- package/src/router.ts +6 -7
package/package.json
CHANGED
package/src/route.ts
CHANGED
|
@@ -887,35 +887,35 @@ export class Route<
|
|
|
887
887
|
private _to!: TrimPathRight<TFullPath>
|
|
888
888
|
|
|
889
889
|
public get to() {
|
|
890
|
-
invariant(
|
|
890
|
+
/* invariant(
|
|
891
891
|
this._to,
|
|
892
892
|
`trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
893
|
-
)
|
|
893
|
+
)*/
|
|
894
894
|
return this._to
|
|
895
895
|
}
|
|
896
896
|
|
|
897
897
|
public get id() {
|
|
898
|
-
invariant(
|
|
898
|
+
/* invariant(
|
|
899
899
|
this._id,
|
|
900
900
|
`trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
901
|
-
)
|
|
901
|
+
)*/
|
|
902
902
|
return this._id
|
|
903
903
|
}
|
|
904
904
|
|
|
905
905
|
public get path() {
|
|
906
|
-
invariant(
|
|
906
|
+
/* invariant(
|
|
907
907
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
908
908
|
this.isRoot || this._id || this._path,
|
|
909
909
|
`trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
910
|
-
)
|
|
910
|
+
)*/
|
|
911
911
|
return this._path
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
public get fullPath() {
|
|
915
|
-
invariant(
|
|
915
|
+
/* invariant(
|
|
916
916
|
this._fullPath,
|
|
917
917
|
`trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
918
|
-
)
|
|
918
|
+
)*/
|
|
919
919
|
return this._fullPath
|
|
920
920
|
}
|
|
921
921
|
|
package/src/router.ts
CHANGED
|
@@ -2133,7 +2133,7 @@ export class Router<
|
|
|
2133
2133
|
(async () => {
|
|
2134
2134
|
const { loaderPromise: prevLoaderPromise } =
|
|
2135
2135
|
this.getMatch(matchId)!
|
|
2136
|
-
|
|
2136
|
+
let loaderRunningAsync = false
|
|
2137
2137
|
if (prevLoaderPromise) {
|
|
2138
2138
|
await prevLoaderPromise
|
|
2139
2139
|
} else {
|
|
@@ -2328,13 +2328,12 @@ export class Router<
|
|
|
2328
2328
|
|
|
2329
2329
|
// If the route is successful and still fresh, just resolve
|
|
2330
2330
|
const { status, invalid } = this.getMatch(matchId)!
|
|
2331
|
-
|
|
2332
|
-
if (preload && route.options.preload === false) {
|
|
2333
|
-
// Do nothing
|
|
2334
|
-
} else if (
|
|
2331
|
+
loaderRunningAsync =
|
|
2335
2332
|
status === 'success' &&
|
|
2336
2333
|
(invalid || (shouldReload ?? age > staleAge))
|
|
2337
|
-
) {
|
|
2334
|
+
if (preload && route.options.preload === false) {
|
|
2335
|
+
// Do nothing
|
|
2336
|
+
} else if (loaderRunningAsync) {
|
|
2338
2337
|
;(async () => {
|
|
2339
2338
|
try {
|
|
2340
2339
|
await runLoader()
|
|
@@ -2353,7 +2352,7 @@ export class Router<
|
|
|
2353
2352
|
|
|
2354
2353
|
updateMatch(matchId, (prev) => ({
|
|
2355
2354
|
...prev,
|
|
2356
|
-
isFetching: false,
|
|
2355
|
+
isFetching: loaderRunningAsync ? prev.isFetching : false,
|
|
2357
2356
|
loaderPromise: undefined,
|
|
2358
2357
|
}))
|
|
2359
2358
|
})(),
|