Skip to content

Commit 20c3ed9

Browse files
committed
fix docs generation
1 parent 6f69b90 commit 20c3ed9

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

docs/start/framework/route-module.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export const clientMiddleware = [loggingMiddleware];
164164
See also:
165165

166166
- [Middleware][middleware]
167+
- [Client Data][client-data]
167168

168169
## `loader`
169170

@@ -217,6 +218,7 @@ That way, React Router can derive types for `loaderData` based on the value of `
217218
See also:
218219

219220
- [`clientLoader` params][client-loader-params]
221+
- [Client Data][client-data]
220222

221223
## `action`
222224

@@ -275,6 +277,7 @@ export async function clientAction({ serverAction }) {
275277
See also:
276278

277279
- [`clientAction` params][client-action-params]
280+
- [Client Data][client-data]
278281

279282
## `ErrorBoundary`
280283

@@ -519,3 +522,4 @@ Next: [Rendering Strategies](./rendering)
519522
[meta-function]: https://api.reactrouter.com/v7/types/react_router.MetaDescriptor.html
520523
[data-mode-should-revalidate]: ../data/route-object#shouldrevalidate
521524
[spa-mode]: ../../how-to/spa
525+
[client-data]: ../../how-to/client-data

packages/react-router/lib/hooks.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,14 @@ function useIsomorphicLayoutEffect(
233233
*
234234
* * `to` can be a string path, a {@link To} object, or a number (delta)
235235
* * `options` contains options for modifying the navigation
236-
* * `flushSync`: Wrap the DOM updates in [`ReactDom.flushSync`](https://react.dev/reference/react-dom/flushSync)
237-
* * `preventScrollReset`: Do not scroll back to the top of the page after navigation
238-
* * `relative`: `"route"` or `"path"` to control relative routing logic
239-
* * `replace`: Replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) stack
240-
* * `state`: Optional [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state) to include with the new {@link Location}
241-
* * `viewTransition`: Enable [`document.startViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for this navigation
236+
* * These options work in all modes (Framework, Data, and Declarative):
237+
* * `relative`: `"route"` or `"path"` to control relative routing logic
238+
* * `replace`: Replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) stack
239+
* * `state`: Optional [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state) to include with the new {@link Location}
240+
* * These options only work in Framework and Data modes:
241+
* * `flushSync`: Wrap the DOM updates in [`ReactDom.flushSync`](https://react.dev/reference/react-dom/flushSync)
242+
* * `preventScrollReset`: Do not scroll back to the top of the page after navigation
243+
* * `viewTransition`: Enable [`document.startViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for this navigation
242244
*
243245
* @example
244246
* import { useNavigate } from "react-router";

packages/react-router/lib/router/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,8 @@ export class ErrorResponseImpl implements ErrorResponse {
20052005
/**
20062006
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
20072007
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
2008-
* thrown from an [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader)
2008+
* thrown from an [`action`](../../start/framework/route-module#action) or
2009+
* [`loader`](../../start/framework/route-module#loader) function.
20092010
*
20102011
* @example
20112012
* import { isRouteErrorResponse } from "react-router";
@@ -2031,7 +2032,6 @@ export class ErrorResponseImpl implements ErrorResponse {
20312032
* @mode data
20322033
* @param error The error to check.
20332034
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
2034-
*
20352035
*/
20362036
export function isRouteErrorResponse(error: any): error is ErrorResponse {
20372037
return (
@@ -2043,6 +2043,12 @@ export function isRouteErrorResponse(error: any): error is ErrorResponse {
20432043
);
20442044
}
20452045

2046+
/*
2047+
lol - this comment is needed because the JSDoc parser for `docs.ts` gets confused
2048+
by the star-slash in the `getRoutePattern` regex and messes up the parsed comment
2049+
for `isRouteErrorResponse` above. This comment seems to reset the parser.
2050+
*/
2051+
20462052
export function getRoutePattern(paths: (string | undefined)[]) {
20472053
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
20482054
}

0 commit comments

Comments
 (0)