Skip to content

Commit 615c9dc

Browse files
committedFeb 5, 2024
chore: Update list of supported versions
BREAKING CHANGE: Drop support for next@14.0.3 Due to a bug in the implementation of shallow routing (WHS), 14.0.3 required a special case for syncing against external navigation. In `nuqs@2.x`, we're cleaning this up and requiring a version of Next.js with bug-free support for shallow routing (with or without experimental WHS in 14.0.4, and with stabilised WHS in 14.0.5 onwards).
1 parent 5f49bd3 commit 615c9dc

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed
 

Diff for: ‎.github/workflows/ci-cd.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ jobs:
2424
base-path: [false, '/base']
2525
window-history-support: [false]
2626
next-version:
27-
- '13.4'
27+
- '13.4' # App router in GA
2828
- '13.5'
2929
- '14.0.1'
3030
# 14.0.2 is not compatible due to a prefetch issue
31-
# 14.0.3 requires the WHS flag (see below)
31+
# 14.0.3 is dropped due to a bug requiring WHS + syncing against uSP,
32+
# which creates other problems under other versions of Next.js
3233
- '14.0.4'
3334
- latest # Current latest is 14.1.0
3435
include:
35-
- next-version: '14.0.3'
36-
window-history-support: true
3736
# 14.0.4 doesn't require the WHS flag, but supports it
3837
- next-version: '14.0.4'
3938
window-history-support: true

Diff for: ‎packages/docs/content/docs/migrations/v2.mdx

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ title: Migration guide to v2
33
description: How to update your code to use nuqs@2.0.0
44
---
55

6+
## Dropped support for `next@14.0.3`
7+
8+
It may seem weird to drop support for a single patch version, and keep it for
9+
older versions, but this is due to a bug in shallow routing in Next.js 14.0.3
10+
that was fixed in 14.0.4, and that became hard to work around without ugly hacks.
11+
12+
See #423 for context and a table of supported versions.
13+
614
## ESM only
715

816
`nuqs@2.0.0` is now an [ESM-only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)

Diff for: ‎packages/nuqs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"prepack": "./scripts/prepack.sh"
5757
},
5858
"peerDependencies": {
59-
"next": ">=13.4 <14.0.2 || ^14.0.3",
59+
"next": ">=13.4 <14.0.2 || ^14.0.4",
6060
"react": "^18.2.0"
6161
},
6262
"dependencies": {

Diff for: ‎packages/nuqs/src/useQueryState.ts

-13
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,6 @@ export function useQueryState<T = string>(
240240
initialSearchParams?.get(key) ?? null
241241
)
242242

243-
React.useEffect(() => {
244-
// This will be removed in v2 which will drop support for
245-
// partially-functional shallow routing (14.0.2 and 14.0.3)
246-
if (window.next?.version !== '14.0.3') {
247-
return
248-
}
249-
const value = initialSearchParams.get(key) ?? null
250-
const state = value === null ? null : safeParse(parse, value, key)
251-
debug('[nuqs `%s`] syncFromUseSearchParams %O', key, state)
252-
stateRef.current = state
253-
setInternalState(state)
254-
}, [initialSearchParams?.get(key), key])
255-
256243
// Sync all hooks together & with external URL changes
257244
React.useInsertionEffect(() => {
258245
function updateInternalState(state: T | null) {

0 commit comments

Comments
 (0)