Skip to content

Commit d3b2be1

Browse files
committed
fix docs generation
1 parent 0b54198 commit d3b2be1

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
@@ -1984,7 +1984,8 @@ export class ErrorResponseImpl implements ErrorResponse {
19841984
/**
19851985
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
19861986
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
1987-
* thrown from an [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader)
1987+
* thrown from an [`action`](../../start/framework/route-module#action) or
1988+
* [`loader`](../../start/framework/route-module#loader) function.
19881989
*
19891990
* @example
19901991
* import { isRouteErrorResponse } from "react-router";
@@ -2010,7 +2011,6 @@ export class ErrorResponseImpl implements ErrorResponse {
20102011
* @mode data
20112012
* @param error The error to check.
20122013
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
2013-
*
20142014
*/
20152015
export function isRouteErrorResponse(error: any): error is ErrorResponse {
20162016
return (
@@ -2022,6 +2022,12 @@ export function isRouteErrorResponse(error: any): error is ErrorResponse {
20222022
);
20232023
}
20242024

2025+
/*
2026+
lol - this comment is needed because the JSDoc parser for `docs.ts` gets confused
2027+
by the star-slash in the `getRoutePattern` regex and messes up the parsed comment
2028+
for `isRouteErrorResponse` above. This comment seems to reset the parser.
2029+
*/
2030+
20252031
export function getRoutePattern(paths: (string | undefined)[]) {
20262032
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
20272033
}

0 commit comments

Comments
 (0)