@@ -11,14 +11,15 @@ Here's a summary of the breaking changes in `nuqs@2.0.0`:
11
11
- [ Deprecated exports have been removed] ( #deprecated-exports )
12
12
- [ Renamed ` nuqs/parsers ` to ` nuqs/server ` ] ( #renamed-nuqsparsers-to-nuqsserver )
13
13
- [ Debug printout detection] ( #debug-printout-detection )
14
+ - [ Dropping ` next-usequerystate ` ] ( #dropping-next-usequerystate )
14
15
15
16
## Adapters
16
17
17
18
The biggest change is that ` nuqs@2.0.0 ` now supports other React frameworks,
18
19
providing type-safe URL state for all.
19
20
20
- You will need to wrap your app with the appropriate ** adapter** for your framework,
21
- to let the hooks know how to interact with its router .
21
+ You will need to wrap your app with the appropriate [ adapter] ( /docs/adapters )
22
+ for your framework or router, to let the hooks know how to interact with it .
22
23
23
24
Adapters are currently available for:
24
25
- Next.js (app & pages routers)
@@ -32,7 +33,7 @@ wrap your app with the appropriate `NuqsAdapter`:
32
33
33
34
### Next.js
34
35
35
- <Callout title = " Minimum required version: next@>=14.2.0" >
36
+ <Callout title = " Minimum required version: next@>=14.2.0" type = " warn " >
36
37
37
38
Early versions of Next.js 14 were in flux with regards to shallow routing.
38
39
Supporting those earlier versions required a lot of hacks, workarounds, and
@@ -89,7 +90,7 @@ import { NuqsAdapter } from 'nuqs/adapters/next'
89
90
### Other adapters
90
91
91
92
Albeit not part of a migration from v1, you can now use nuqs in other React
92
- frameworks via their respective [ adapters] ( https://nuqs.47ng.com /docs/adapters) .
93
+ frameworks via their respective [ adapters] ( /docs/adapters ) .
93
94
94
95
{ /* todo: Add the docs/adapters page */ }
95
96
@@ -98,15 +99,15 @@ a long-standing issue with testing components using nuqs hooks:
98
99
99
100
### Testing adapter
100
101
101
- Until now, unit -testing nuqs components was a hassle, as it required mocking
102
- Next.js internals, causing abstraction leaks.
102
+ Unit -testing components that used nuqs v1 was a hassle, as it required mocking
103
+ the Next.js router internals, causing abstraction leaks.
103
104
104
- You can now wrap your components to test with the ` NuqsTestingAdapter ` , which
105
- provides setup & assertion helpers for your tests.
105
+ In v2, you can now wrap your components to test with the [ ` NuqsTestingAdapter ` ] ( /docs/testing ) ,
106
+ which provides a convenient setup & assertion API for your tests.
106
107
107
108
Here's an example with Vitest & Testing Library:
108
109
109
- ``` tsx
110
+ ``` tsx title="counter-button-example.test.tsx"
110
111
import { render , screen } from ' @testing-library/react'
111
112
import userEvent from ' @testing-library/user-event'
112
113
import { NuqsTestingAdapter , type UrlUpdateEvent } from ' nuqs/adapters/testing'
@@ -138,10 +139,10 @@ it('should increment the count when clicked', async () => {
138
139
139
140
## Behaviour changes
140
141
141
- Setting ` startTransition ` no longer sets ` shallow: false ` automatically.
142
+ Setting the ` startTransition ` option no longer sets ` shallow: false ` automatically.
143
+
142
144
In Next.js, you'll have to specify both to get a loading state.
143
- This is to align with other frameworks that don't have a concept of shallow
144
- (or deep) routing.
145
+ This is to align with other frameworks that don't have a concept of shallow/deep routing.
145
146
146
147
As a consequence, the ` Options ` type is no longer generic.
147
148
@@ -199,11 +200,11 @@ Replace with `parseAsXYZ` to match:
199
200
### ` subscribeToQueryUpdates `
200
201
201
202
Next.js 14.1.0 makes ` useSearchParams ` reactive to shallow search params updates,
202
- which makes this internal helper function redundant. See #425 for context.
203
+ which makes this internal helper function redundant. See [ #425 ] ( https://github.com/47ng/nuqs/pull/425 ) for context.
203
204
204
205
## Renamed ` nuqs/parsers ` to ` nuqs/server `
205
206
206
- When introducing the server cache in # 387 , the dedicated export for parsers was
207
+ When introducing the server cache in [ # 397 ] ( https://github.com/47ng/nuqs/pull/397 ) , the dedicated export for parsers was
207
208
reused as it didn't include the ` "use client" ` directive. Since it now contains
208
209
more than parsers and probably will be extended with server-only code in the future,
209
210
it has been renamed to a clearer export name.
@@ -228,3 +229,11 @@ if (localStorage.debug) {
228
229
localStorage .debug = localStorage .debug .replace (' next-usequerystate' , ' nuqs' )
229
230
}
230
231
```
232
+
233
+ ## Dropping next-usequerystate
234
+
235
+ This package started under the name ` next-usequerystate ` , and was renamed to
236
+ ` nuqs ` in January 2024. The old package name was kept as an alias for the v1
237
+ release line.
238
+
239
+ ` nuqs ` version 2 and onwards no longer mirror to the ` next-usequerystate ` package name.
0 commit comments