Skip to content

Commit 64eb2c1

Browse files
authored
docs: Update RouteOptionsType doc to reflect correct Loader opts (#4265)
1 parent 52f06b4 commit 64eb2c1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/router/framework/react/api/router/RouteOptionsType.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ type beforeLoad = (
124124
```tsx
125125
type loader = (
126126
opts: RouteMatch & {
127-
search: TFullSearchSchema
128127
abortController: AbortController
129-
preload: boolean
130-
params: TAllParams
128+
cause: 'enter' | 'stay'
131129
context: TAllContext
130+
deps: TLoaderDeps
132131
location: ParsedLocation
132+
params: TAllParams
133+
preload: boolean
134+
parentMatchPromise: Promise<MakeRouteMatchFromRoute<TParentRoute>>
133135
navigate: NavigateFn<AnyRoute> // @deprecated
134-
buildLocation: BuildLocationFn<AnyRoute>
135-
cause: 'enter' | 'stay'
136136
},
137137
) => Promise<TLoaderData> | TLoaderData | void
138138
```
@@ -142,6 +142,7 @@ type loader = (
142142
- This async function is called when a route is matched and passed the route's match object. If an error is thrown here, the route will be put into an error state and the error will be thrown during render. If thrown during a navigation, the navigation will be canceled and the error will be passed to the `onError` function. If thrown during a preload event, the error will be logged to the console and the preload will fail.
143143
- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the `pendingComponent` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render.
144144
- If this function returns a `TLoaderData` object, that object will be stored on the route match until the route match is no longer active. It can be accessed using the `useLoaderData` hook in any component that is a child of the route match before another `<Outlet />` is rendered.
145+
- Deps must be returned by your `loaderDeps` function in order to appear.
145146
146147
> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](../redirectFunction.md).
147148
@@ -292,7 +293,7 @@ interface RemountDepsOptions<
292293
- The return value needs to be JSON serializable.
293294
- By default, a route component will not be remounted if it stays active after a navigation.
294295

295-
Example:
296+
Example:
296297
If you want to configure to remount a route component upon `params` change, use:
297298

298299
```tsx

0 commit comments

Comments
 (0)