@tanstack/react-router 1.19.8 → 1.19.10

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/src/Matches.tsx CHANGED
@@ -224,9 +224,19 @@ function MatchInner({
224
224
  ErrorComponent
225
225
 
226
226
  if (match.status === 'notFound') {
227
- invariant(isNotFound(match.error), 'Expected a notFound error')
227
+ let error: unknown
228
+ if (isServerSideError(match.error)) {
229
+ const deserializeError =
230
+ router.options.errorSerializer?.deserialize ?? defaultDeserializeError
231
+
232
+ error = deserializeError(match.error.data)
233
+ } else {
234
+ error = match.error
235
+ }
236
+
237
+ invariant(isNotFound(error), 'Expected a notFound error')
228
238
 
229
- return renderRouteNotFound(router, route, match.error.data)
239
+ return renderRouteNotFound(router, route, error)
230
240
  }
231
241
 
232
242
  if (match.status === 'redirected') {
package/src/router.ts CHANGED
@@ -1602,6 +1602,10 @@ export class Router<
1602
1602
  } catch (err) {
1603
1603
  if (isRedirect(err)) {
1604
1604
  redirect = this.resolveRedirect(err)
1605
+
1606
+ if (!isServer) {
1607
+ this.navigate({ ...(redirect as any), replace: true })
1608
+ }
1605
1609
  } else if (isNotFound(err)) {
1606
1610
  notFound = err
1607
1611
  this.handleNotFound(pendingMatches, err)