Skip to content
Source
Sign inSign up
TanStack/router

docs(router): say onCatch runs only on routes with an error component #8836

OpenEduKegler(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/8836/headopened

Showing 3 changed files with 5 additions and 3 deletions.

x
0 of 3 viewed, 3 left
2 additions and 1 deletiondocs/router/api/router/RouteOptionsType.mdModified
View file
@@ -301,7 +301,8 @@
​
- Type: `(error: unknown) => void` in React and Vue; `(error: Error) => void` in Solid
- Optional - Defaults to `routerOptions.defaultOnCatch`
-- A function that will be called when errors are caught when the route encounters an error.
+- The route's error boundary calls this function when it catches an error. A not-found error skips this function and goes to the not-found boundary.
+- The route has an error boundary only when it has an `errorComponent` or the router has a `defaultErrorComponent`. Without either, `onCatch` is not called.
​
### `remountDeps` method
​
2 additions and 1 deletiondocs/router/api/router/RouterOptionsType.mdModified
View file
@@ -143,7 +143,8 @@
​
- Type: `(error: unknown, errorInfo: ErrorInfo) => void`
- Optional
-- The default `onCatch` handler for errors caught by the Router ErrorBoundary
+- The default `onCatch` handler for errors caught by a route's error boundary. A not-found error skips this handler and goes to the not-found boundary.
+- A route has an error boundary only when it has an `errorComponent` or the router has a `defaultErrorComponent`. The global catch boundary does not call `defaultOnCatch`.
​
### `disableGlobalCatchBoundary` property
​
1 addition and 1 deletiondocs/router/guide/data-loading.mdModified
View file
@@ -565,7 +565,7 @@
​