@tanstack/react-router 1.33.2 → 1.33.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/src/router.ts CHANGED
@@ -126,42 +126,214 @@ export interface RouterOptions<
126
126
  TDehydrated extends Record<string, any> = Record<string, any>,
127
127
  TSerializedError extends Record<string, any> = Record<string, any>,
128
128
  > {
129
+ /**
130
+ * The history object that will be used to manage the browser history.
131
+ * If not provided, a new createBrowserHistory instance will be created and used.
132
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
133
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
134
+ */
129
135
  history?: RouterHistory
136
+ /**
137
+ * A function that will be used to stringify search params when generating links.
138
+ * Defaults to `defaultStringifySearch`.
139
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
140
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
141
+ */
130
142
  stringifySearch?: SearchSerializer
143
+ /**
144
+ * A function that will be used to parse search params when parsing the current location.
145
+ * Defaults to `defaultParseSearch`.
146
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
147
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
148
+ */
131
149
  parseSearch?: SearchParser
150
+ /**
151
+ * Defaults to `false`
152
+ * If `false`, routes will not be preloaded by default in any way.
153
+ * If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
154
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
155
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
156
+ */
132
157
  defaultPreload?: false | 'intent'
158
+ /**
159
+ * Defaults to 50
160
+ * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
161
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
162
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
163
+ */
133
164
  defaultPreloadDelay?: number
165
+ /**
166
+ * Defaults to `Outlet`
167
+ * The default `component` a route should use if no component is provided.
168
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
169
+ */
134
170
  defaultComponent?: RouteComponent
171
+ /**
172
+ * Defaults to `ErrorComponent`
173
+ * The default `errorComponent` a route should use if no error component is provided.
174
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
175
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
176
+ */
135
177
  defaultErrorComponent?: ErrorRouteComponent
178
+ /**
179
+ * The default `pendingComponent` a route should use if no pending component is provided.
180
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
181
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
182
+ */
136
183
  defaultPendingComponent?: RouteComponent
184
+ /**
185
+ * Defaults to `1000`
186
+ * The default `pendingMs` a route should use if no pendingMs is provided.
187
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
188
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
189
+ */
137
190
  defaultPendingMs?: number
191
+ /**
192
+ * Defaults to `500`
193
+ * The default `pendingMinMs` a route should use if no pendingMinMs is provided.
194
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
195
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
196
+ */
138
197
  defaultPendingMinMs?: number
198
+ /**
199
+ * Defaults to `0`
200
+ * The default `staleTime` a route should use if no staleTime is
201
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
202
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
203
+ */
139
204
  defaultStaleTime?: number
205
+ /**
206
+ * Defaults to `30_000` ms (30 seconds)
207
+ * The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
208
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
209
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
210
+ */
140
211
  defaultPreloadStaleTime?: number
212
+ /**
213
+ * Defaults to `routerOptions.defaultGcTime`, which defaults to 30 minutes.
214
+ * The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.
215
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
216
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
217
+ */
141
218
  defaultPreloadGcTime?: number
219
+ /**
220
+ * The default `onCatch` handler for errors caught by the Router ErrorBoundary
221
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)
222
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)
223
+ */
142
224
  defaultOnCatch?: (error: Error, errorInfo: ErrorInfo) => void
143
225
  defaultViewTransition?: boolean
226
+ /**
227
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
228
+ */
144
229
  notFoundMode?: 'root' | 'fuzzy'
230
+ /**
231
+ * Defaults to 30 minutes.
232
+ * The default `gcTime` a route should use if no
233
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
234
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
235
+ */
145
236
  defaultGcTime?: number
237
+ /**
238
+ * Defaults to `false`
239
+ * If `true`, all routes will be matched as case-sensitive.
240
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
241
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-trees#case-sensitivity)
242
+ */
146
243
  caseSensitive?: boolean
244
+ /**
245
+ * Required
246
+ * The route tree that will be used to configure the router instance.
247
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
248
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-trees)
249
+ */
147
250
  routeTree?: TRouteTree
251
+ /**
252
+ * Defaults to `/`
253
+ * The basepath for then entire router. This is useful for mounting a router instance at a subpath.
254
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
255
+ */
148
256
  basepath?: string
257
+ /**
258
+ * Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
259
+ * The root context that will be provided to all routes in the route tree.
260
+ * This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
261
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
262
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
263
+ */
149
264
  context?: TRouteTree['types']['routerContext']
265
+ /**
266
+ * A function that will be called when the router is dehydrated.
267
+ * The return value of this function will be serialized and stored in the router's dehydrated state.
268
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
269
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
270
+ */
150
271
  dehydrate?: () => TDehydrated
272
+ /**
273
+ * A function that will be called when the router is hydrated.
274
+ * The return value of this function will be serialized and stored in the router's dehydrated state.
275
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
276
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
277
+ */
151
278
  hydrate?: (dehydrated: TDehydrated) => void
279
+ /**
280
+ * An array of route masks that will be used to mask routes in the route tree.
281
+ * Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.
282
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
283
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
284
+ */
152
285
  routeMasks?: Array<RouteMask<TRouteTree>>
286
+ /**
287
+ * Defaults to `false`
288
+ * If `true`, route masks will, by default, be removed when the page is reloaded.
289
+ * This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.
290
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
291
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
292
+ */
153
293
  unmaskOnReload?: boolean
294
+ /**
295
+ * A component that will be used to wrap the entire router.
296
+ * This is useful for providing a context to the entire router.
297
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
298
+ */
154
299
  Wrap?: (props: { children: any }) => React.JSX.Element
300
+ /**
301
+ * A component that will be used to wrap the inner contents of the router.
302
+ * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
303
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
304
+ */
155
305
  InnerWrap?: (props: { children: any }) => React.JSX.Element
156
306
  /**
157
307
  * @deprecated
158
308
  * Use `notFoundComponent` instead.
159
309
  * See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
310
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
160
311
  */
161
312
  notFoundRoute?: AnyRoute
313
+ /**
314
+ * Defaults to `NotFound`
315
+ * The default `notFoundComponent` a route should use if no notFound component is provided.
316
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
317
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
318
+ */
162
319
  defaultNotFoundComponent?: NotFoundRouteComponent
320
+ /**
321
+ * The transformer that will be used when sending data between the server and the client during SSR.
322
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#transformer-property)
323
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/ssr#data-transformers)
324
+ */
163
325
  transformer?: RouterTransformer
326
+ /**
327
+ * The serializer object that will be used to determine how errors are serialized and deserialized between the server and the client.
328
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#errorserializer-property)
329
+ */
164
330
  errorSerializer?: RouterErrorSerializer<TSerializedError>
331
+ /**
332
+ * Defaults to `never`
333
+ * Configures how trailing slashes are treated.
334
+ * `'always'` will add a trailing slash if not present, `'never'` will remove the trailing slash if present and `'preserve'` will not modify the trailing slash.
335
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
336
+ */
165
337
  trailingSlash?: TTrailingSlashOption
166
338
  }
167
339