nuqs

Type-safe search params state manager for Next.js - Like React.useState, but stored in the URL query string.

MIT License

Downloads
974.2K
Stars
1.7K

Bot releases are visible (Hide)

nuqs - v1.10.1

Published by github-actions[bot] 11 months ago

1.10.1 (2023-11-09)

An internal Next.js app router change (https://github.com/vercel/next.js/pull/56497) causes prefetch links to reset shallow URL updates on hover or mount. It was introduced between [email protected](last known working version) and [email protected], then released on stable in [email protected].

Consequently, next-usequerystate is marked as being incompatible with the latest Next.js versions until I have identified the root cause, and a fixing PR is merged and released.

Bug Fixes

  • Mark incompatibility with 14.0.2 due to #388 (2e26a81)
nuqs - v1.10.1-beta.1

Published by github-actions[bot] 11 months ago

1.10.1-beta.1 (2023-11-09)

Bug Fixes

  • Mark incompatibility with 14.0.2 due to #388 (2e26a81)
nuqs - v1.10.0

Published by github-actions[bot] 12 months ago

1.10.0 (2023-11-08)

Features

  • Add throttling option (596d835), closes #373. Thanks @ShahriarKh !
  • Allow chaining parser options & default values (c012c31), closes #386
  • Allow infinite throttleMs to disable URL updates (51ceed6)

Bug Fixes

  • Always update local URL first, then RSC (943ce9b)
  • Detect multiple patching with different versions (cef5808)
  • Handle conflicts between RSC & local queue (e76e4de)

Other changes

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.9.2...v1.10.0

nuqs - v1.10.0-beta.1

Published by github-actions[bot] 12 months ago

1.10.0-beta.1 (2023-11-08)

Bug Fixes

  • Always update local URL first, then RSC (943ce9b)
  • Detect multiple patching with different versions (cef5808)
  • Handle conflicts between RSC & local queue (e76e4de)

Features

  • Add throttling option (596d835), closes #373
  • Allow chaining parser options & default values (c012c31), closes #386
  • Allow infinite throttleMs to disable URL updates (51ceed6)
nuqs - v1.9.2

Published by github-actions[bot] 12 months ago

1.9.2 (2023-11-02)

Bug Fixes

  • Default value on server-side parsing (45029d4), closes #384. Thanks @ru-van-urk !

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.9.1...v1.9.2

nuqs - v1.9.1

Published by github-actions[bot] 12 months ago

1.9.1 (2023-10-26)

Dependencies

  • deps: Add Next.js 14 support (878eb72)

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.9.0...v1.9.1

nuqs - v1.9.0

Published by github-actions[bot] 12 months ago

1.9.0 (2023-10-26)

Features

  • Prettify URLs (383aca7), closes #355. Thanks to @tordans!
  • Better debugging story (879012b)

Bug Fixes

  • Encode characters that may break URL detection (29d878c)

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.8.4...v1.9.0

nuqs - v1.9.0-beta.2

Published by github-actions[bot] 12 months ago

1.9.0-beta.2 (2023-10-24)

Features

nuqs - v1.9.0-beta.1

Published by github-actions[bot] 12 months ago

1.9.0-beta.1 (2023-10-23)

Bug Fixes

  • Encode characters that may break URL detection (29d878c)

Features

nuqs - v1.8.5-beta.1

Published by github-actions[bot] 12 months ago

1.8.5-beta.1 (2023-10-22)

Bug Fixes

  • Output a debug build with user timings marks (989f165)
nuqs - v1.8.4

Published by github-actions[bot] about 1 year ago

1.8.4 (2023-10-15)

Bug Fixes

  • #368: replace next/navigation with next/navigation.js by @mateogianolio (cc6dda6), closes #368
  • Handle invalid dates (cdb7547)

New Contributors

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.8.3...v1.8.4

nuqs - v1.8.3

Published by github-actions[bot] about 1 year ago

1.8.3 (2023-10-13)

Bug Fixes

  • Check array index access (73c120c)
nuqs - v1.8.3-beta.1

Published by github-actions[bot] about 1 year ago

1.8.3-beta.1 (2023-10-13)

Bug Fixes

  • Check array index access (73c120c)
nuqs - v1.8.2

Published by github-actions[bot] about 1 year ago

1.8.2 (2023-10-04)

Bug Fixes

  • Consider queued updates for initial state (e10c85c), closes #359. Thanks @jebie!
  • List types first in export map (af0729d)
nuqs - v1.8.2-beta.1

Published by github-actions[bot] about 1 year ago

1.8.2-beta.1 (2023-10-04)

Bug Fixes

  • Consider queued updates for initial state (e10c85c), closes #359
  • List types first in export map (af0729d)
nuqs - v1.8.1

Published by github-actions[bot] about 1 year ago

1.8.1 (2023-09-20)

Performance Improvements

  • Replace update queue with a Map (a1f84cf)
nuqs - v1.8.1-beta.1

Published by github-actions[bot] about 1 year ago

1.8.1-beta.1 (2023-09-20)

Performance Improvements

  • Replace update queue with a Map (a1f84cf)
nuqs - v1.8.0

Published by github-actions[bot] about 1 year ago

1.8.0 (2023-09-15)

Announcement blog post: https://francoisbest.com/posts/2023/storing-react-state-in-the-url-with-nextjs

This release brings support for the app router, and requires Next.js 13.4+.

It is a complete internal rewrite, that gives us:

  • Optimal performance (now identical to React.useState)
  • Shallow mode by default
  • Batched updates
  • SSR in Server Components with correct query values (no more hydration tricks or errors)
  • Better DX for creating and configuring parsers
  • Finer control over options

Refer to the documentation for more details.

Behavioural changes

Query updates are using the following defaults, that changed from the previous version:

  • scroll: false
  • shallow: true

Read the options documentation to configure those behaviours.

Features

  • Add hex parser (7d9e7b9)
  • Add parser argument for JSON types (a2e7c3d)
  • Add server-side parser utility (e225975), closes #348
  • Allow server-side parser access (29d4d86), closes #348
  • App router now uses history API (ba5e3e0)
  • Cache returned promise until next flush (aa0619b)
  • Name patched functions for better stack traces (5b7c494)
  • Single app/pages implementation (f4817f5)
  • Spy on all query changes (b9a24cc)
  • Update to useRouter from next/navigation (a604351), closes #327

Bug Fixes

Deprecations

The queryTypes parser bag is marked as deprecated, as it wasn't tree-shakeable. It is replaced by individual parsers.

- import { useQueryState, queryTypes } from 'next-usequerystate'
+ import { useQueryState, parseAsInteger } from 'next-usequerystate'

- useQueryState('counter', queryTypes.integer.withDefault(0))
+ useQueryState('counter', parseAsInteger.withDefault(0))

Some internal type definitions have been renamed for consistency across the codebase.
Since they were exported, the change is retro-compatible with deprecation notices on the old type names.

Those deprecated exports will be removed in the next major version (2.0.0).

Credits

A big thanks to all who have helped testing the beta versions, and especially:

  • @andreisocaciu for laying the ground work (#328).
  • @caillou for early performance testing.
  • @tacomanator for fishing out two race-conditions on initial navigation (#343).
  • @ryan-walsh-forte for uncovering a race condition in state updater functions (#345).
  • @r1chm8 for the idea of making the parsers server-side accessible to let server components hydrate and validate query values (#348).
  • @jdddog for uncovering issues with module resolution (#352).

Full Changelog: https://github.com/47ng/next-usequerystate/compare/v1.7.3...v1.8.0

nuqs - v1.8.0-beta.15

Published by github-actions[bot] about 1 year ago

1.8.0-beta.15 (2023-09-15)

Bug Fixes

  • State updater function should be based on state (f788381)
  • useInsertionEffect for useQueryStates (8b8b2e9)
nuqs - v1.8.0-beta.14

Published by github-actions[bot] about 1 year ago

1.8.0-beta.14 (2023-09-14)

Bug Fixes

  • Reduce package size by hotlinking GIF (000aa62)