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.17.4 Latest Release

Published by github-actions[bot] 5 months ago

1.17.4 (2024-05-14)

Bug Fixes

  • Harden debug reading of localStorage (#560) (8af53ad)
nuqs - v1.17.3

Published by github-actions[bot] 5 months ago

1.17.3 (2024-05-14)

Bug Fixes

  • don't fail parse if called again with identical input (#557) (2727585)
nuqs - v1.17.3-beta.1

Published by github-actions[bot] 5 months ago

1.17.3-beta.1 (2024-05-13)

Bug Fixes

  • don't fail parse if called again with identical input (#557) (2727585)
nuqs - v1.17.2

Published by github-actions[bot] 6 months ago

1.17.2 (2024-05-06)

Bug Fixes

  • Don't rely on URL for initial state (9912eef)
nuqs - v1.17.2-beta.1

Published by github-actions[bot] 6 months ago

1.17.2-beta.1 (2024-04-21)

Bug Fixes

  • Don't rely on URL for initial state (9912eef)
nuqs - v1.17.1

Published by github-actions[bot] 8 months ago

1.17.1 (2024-03-02)

Bug Fixes

  • Equality check for non-primitives in clearOnDefault (#504) (e8c9720). Thanks @Kavan72 !
nuqs - v1.17.0

Published by github-actions[bot] 8 months ago

1.17.0 (2024-02-13)

Features

nuqs - v1.17.0-beta.1

Published by github-actions[bot] 8 months ago

1.17.0-beta.1 (2024-02-11)

Features

nuqs - v1.16.1

Published by github-actions[bot] 9 months ago

1.16.1 (2024-02-01)

Bug Fixes

  • Sync with useSearchParams in 14.1.0 (#482) - Thanks @ianldgs, @aldenquimby, and @skve !

Full Changelog: https://github.com/47ng/nuqs/compare/v1.16.0...v1.16.1

nuqs - v1.16.1-beta.1

Published by github-actions[bot] 9 months ago

1.16.1-beta.1 (2024-02-01)

Bug Fixes

  • Sync with useSearchParams in 14.1.0 (50da148)
nuqs - v1.16.0

Published by github-actions[bot] 9 months ago

1.16.0 (2024-01-28)

Features

nuqs - v1.16.0-beta.1

Published by github-actions[bot] 9 months ago

1.16.0-beta.1 (2024-01-27)

Features

nuqs - v1.15.4

Published by github-actions[bot] 9 months ago

1.15.4 (2024-01-19)

Bug Fixes

nuqs - v2.0.0-beta.1

Published by github-actions[bot] 9 months ago

2.0.0-beta.1 (2024-01-18)

Breaking changes / Migration guide

Dropped support for [email protected]

It may seem weird to drop support for a single patch version, and keep it for older versions, but this is due to a bug in shallow routing in Next.js 14.0.3 that was fixed in 14.0.4, and that became hard to work around without ugly hacks as Next.js releases evolved.

See #423 for context and a table of supported versions.

ESM only

[email protected] is now an ESM-only package. This should not be much of an issue since Next.js supported ESM since version 12, but if you are bundling nuqs code into an intermediate CJS library to be consumed in Next.js, you'll run into import issues. Outside of converting your library to ESM (future-proof), your main option is to dynamically import nuqs:

const { useQueryState } = await import('nuqs')

Deprecated exports

Some of the v1 API was marked as deprecated back in September 2023, and has been removed in [email protected].

queryTypes parsers object

Replace with parseAsXYZ to match, for better tree-shakeability:

- import { queryTypes } from 'nuqs'
+ import { parseAsString, parseAsInteger, ... } from 'nuqs'

- useQueryState('q',    queryTypes.string.withOptions({ ... }))
- useQueryState('page', queryTypes.integer.withDefault(1))
+ useQueryState('q',    parseAsString.withOptions({ ... }))
+ useQueryState('page', parseAsInteger.withDefault(1))

subscribeToQueryUpdates

Next.js 14.0.5 makes useSearchParams reactive to shallow search params updates, which makes this internal helper function redundant. See #425 for context.

Renamed nuqs/parsers to nuqs/server

When introducing the server cache in #387, the dedicated export for parsers was reused as it didn't include the "use client" directive. Since it now contains more than parsers and probably will be extended with server-only code in the future, it has been renamed to a clearer export name.

Find and replace all occurrences of 'nuqs/parsers' to 'nuqs/server' in your code:

- import { parseAsInteger, createSearchParamsCache } from 'nuqs/parsers'
+ import { parseAsInteger, createSearchParamsCache } from 'nuqs/server'

Debug printout detection

After the rename to nuqs, the debugging printout detection logic handled either next-usequerystate or nuqs being present in the localStorage.debug variable. In [email protected] it only checks for the presence of the nuqs substring to enable logs. Update your local dev environments to match by running this once in the devtools console:

if (localStorage.debug) {
  localStorage.debug = localStorage.debug.replace('next-usequerystate', 'nuqs') 
}

Misc changes

  • Drop mirrorring to next-usequerystate (abcbfdc)
  • ESM only (drop CJS support) (b515c79)
  • Remove deprecated APIs (5dd12c9), closes #425
  • Rename nuqs/parsers to nuqs/server (ad3aa48)
  • Update list of supported versions (9187252)
nuqs - v1.15.3

Published by github-actions[bot] 9 months ago

1.15.3 (2024-01-17)

Bug Fixes

Full Changelog: https://github.com/47ng/nuqs/compare/v1.15.2...v1.15.3

nuqs - v1.15.2

Published by github-actions[bot] 9 months ago

1.15.2 (2024-01-15)

Bug Fixes

  • Check for null next property on window (#456) (ef75b2c), closes #454. Thanks @sunwrobert !

Full Changelog: https://github.com/47ng/nuqs/compare/v1.15.1...v1.15.2

nuqs - v1.15.1

Published by github-actions[bot] 9 months ago

1.15.1 (2024-01-14)

Bug Fixes

nuqs - v1.15.0

Published by github-actions[bot] 9 months ago

1.15.0 (2024-01-14)

What's Changed

New Contributors

Full Changelog: https://github.com/47ng/nuqs/compare/v1.14.1...v1.15.0

nuqs - v1.14.1

Published by github-actions[bot] 9 months ago

1.14.1 (2024-01-10)

Bug Fixes

Other changes

Full Changelog: https://github.com/47ng/nuqs/compare/v1.14.0...v1.14.1

nuqs - v1.14.1-beta.1

Published by github-actions[bot] 9 months ago

1.14.1-beta.1 (2024-01-09)

Bug Fixes