@tanstack/router-core 1.133.12 → 1.133.15
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 +12 -2
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +12 -2
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +13 -3
package/src/router.ts
CHANGED
|
@@ -1162,7 +1162,6 @@ export class RouterCore<
|
|
|
1162
1162
|
maskedLocation: location,
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
|
|
1166
1165
|
return location
|
|
1167
1166
|
}
|
|
1168
1167
|
|
|
@@ -1966,7 +1965,12 @@ export class RouterCore<
|
|
|
1966
1965
|
trimPath(normalizeUrl(this.latestLocation.href)) !==
|
|
1967
1966
|
trimPath(normalizeUrl(nextLocation.href))
|
|
1968
1967
|
) {
|
|
1969
|
-
|
|
1968
|
+
let href = nextLocation.url
|
|
1969
|
+
if (this.origin && href.startsWith(this.origin)) {
|
|
1970
|
+
href = href.replace(this.origin, '') || '/'
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
throw redirect({ href })
|
|
1970
1974
|
}
|
|
1971
1975
|
}
|
|
1972
1976
|
|
|
@@ -2131,10 +2135,16 @@ export class RouterCore<
|
|
|
2131
2135
|
await this.latestLoadPromise
|
|
2132
2136
|
}
|
|
2133
2137
|
|
|
2138
|
+
let newStatusCode: number | undefined = undefined
|
|
2134
2139
|
if (this.hasNotFoundMatch()) {
|
|
2140
|
+
newStatusCode = 404
|
|
2141
|
+
} else if (this.__store.state.matches.some((d) => d.status === 'error')) {
|
|
2142
|
+
newStatusCode = 500
|
|
2143
|
+
}
|
|
2144
|
+
if (newStatusCode !== undefined) {
|
|
2135
2145
|
this.__store.setState((s) => ({
|
|
2136
2146
|
...s,
|
|
2137
|
-
statusCode:
|
|
2147
|
+
statusCode: newStatusCode,
|
|
2138
2148
|
}))
|
|
2139
2149
|
}
|
|
2140
2150
|
}
|