Use Query Params Versions Save

React Hook for managing state in URL query parameters with easy serialization.

v1.1.7

3 years ago
  • More careful caching of param configs via #121 #122

v1.1.6

3 years ago
  • Fixes bug where functional updates were broken when the value needed to be encoded #116 #117

v1.1.5

3 years ago
  • Fixes #113 bug where if the query config changed, things would break due to caching

v1.1.4

3 years ago
  • Fixes a bug where withDefault didn't work with DateParams #111

v1.1.3

3 years ago
  • Fixes problem where dates didn't update properly due to shallowEqual not working on them. Solution is to support an equals field on parameters (updated DateParam and DateTimeParam accordingly). #100

v1.1.2

3 years ago
  • Fixes a bug where location would be stale on first useEffect after a page transition #95

v1.1.1

4 years ago
  • Resolves #91 to improve withDefault typing with useQueryParam

v1.1.0

4 years ago
  • Adds new stringifyOptions prop to QueryParamProvider to allow passing options to stringify #23
  • Adds support for functional updates e.g. setQuery(latestQuery => ({ newValue: 123 + latestQuery.newValue }) #26

v1.0.0

4 years ago

Breaking Changes

  • Updates to serialize-query-params v1.0.1

    • #73 #49 #79
    • This changes how empty strings and null are handled. Previously they were auto filtered out / became undefined, but now they are accepted as possible values. foo = null -> ?foo, foo = '' -> ?foo=, foo = undefined -> ? (removes if present--this was current behavior)
    • This means values may be decoded as null, which breaks how you may normally provide default values (const { foo = [] } = query won't work when foo = null). To get around this, a withDefault helper has been added.
    • To provide a default value, wrap your param with withDefault. e.g. useQueryParams({ foo: withDefault(ArrayParam, []) })
    • query-string is no longer directly exported or depended on. It is now a peer dependency, v5.1.1 or v6 will work, you decide what you use.
  • #76 Switches default update type from replaceIn to pushIn

New Features

  • #62 multiple updates in a single render has been fixed thanks to @dprgarner's reworking of how locations passed around internally (see #84, #86)
  • #69 new HOC withQueryParamsMapped has been added that provides a mapToProps API similar to react-redux connect
  • #82 Warns in dev if you forgot to add QueryParamProvider

v0.6.0

4 years ago
  • Possibly breaking Updates serialize-query-params to 0.3.0 which now allows empty strings to be valid values in objects. For example: { foo: '' } will now serialize as foo- and deserialize to { foo: '' }. Previously empty string values were discarded and foo- would be deserialized to {foo: undefined }