Skip to content

Commit ee053e4

Browse files
committed
doc: Details for NuqsTestingAdapter props
1 parent 7fcff7c commit ee053e4

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/docs/content/docs/testing.mdx

+22-1
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,35 @@ it directly.
114114

115115
It takes the following props:
116116

117-
- `searchParams`: The initial search params to use for the test. These can be a
117+
- `searchParams{:ts}`: The initial search params to use for the test. These can be a
118118
query string, a `URLSearchParams` object or a record object with string values.
119119

120120
```tsx
121+
import { NuqsTestingAdapter } from 'nuqs/adapters/testing'
122+
121123
<NuqsTestingAdapter searchParams="?q=hello&limit=10">
122124
<NuqsTestingAdapter searchParams={new URLSearchParams("?q=hello&limit=10")}>
123125
<NuqsTestingAdapter searchParams={{
124126
q: 'hello',
125127
limit: '10' // Values are serialized strings
126128
}}>
127129
```
130+
131+
- `onUrlUpdate{:ts}`, a function that will be called when the URL is updated
132+
by the component. It receives an object with:
133+
- the new search params as an instance of `URLSearchParams{:ts}`
134+
- the new querystring (for convenience)
135+
- the options used to update the URL.
136+
137+
<details>
138+
<summary>🧪 Internal/advanced options</summary>
139+
140+
- `rateLimitFactor{:ts}`. By default, rate limiting is disabled when testing,
141+
as it can lead to unexpected behaviours. Setting this to 1 will enable rate
142+
limiting with the same factor as in production.
143+
144+
- `resetUrlUpdateQueueOnMount{:ts}`: clear the URL update queue before running the test.
145+
This is `true{:ts}` by default to isolate tests, but you can set it to `false{:ts}` to keep the
146+
URL update queue between renders and match the production behaviour more closely.
147+
148+
</details>

0 commit comments

Comments
 (0)