[patch] Update dependency use-query-params to v2 #222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^1.2.3
->^2.0.0
Release Notes
pbeshai/use-query-params (use-query-params)
v2.2.1
: v2.2.1Compare Source
use-query-params v2.2.1 (March 24, 2023)
v2.2.0
: v2.2.0Compare Source
v2.1.2
Compare Source
v2.1.1
: v2.1.1Compare Source
v2.1.0
: v2.1.0Compare Source
use-query-params v2.1.0 (August 31, 2022)
skipUpdateWhenNoChange
defaults to true (set to false for previous behavior)v2.0.1
: v2.0.1Compare Source
use-query-params v2.0.1 (August 31, 2022)
v2.0.0
: v2.0.0Compare Source
use-query-params v2.0.0
Breaking
null
. You can continue using query-string by specifying thesearchStringToObject
andobjectToSearchString
options as parse and stringify respectively.New Features
Deep imports for React-Router 5 and 6 adapters
Supports registering params in the QueryParamProvider to have them available to any downstream hooks.
Additional function signatures have been added, but greater care must be taken to get proper types out of the response.
useQueryParam(’myparam’)
← param type is inherited from the params registered in the QueryParamProvideruseQueryParam(’myparam’, StringParam, options)
useQueryParams()
← gets all params from the QueryParamProvideruseQueryParams([’myparam1’, ‘myparam2’])
← gets just myparam1 and myparam2 from those registered in the QueryParamProvider.useQueryParams({ myparam: StringParam }, options)
useQueryParams({ myparam: ‘inherit’ }, options)
←inherit myparam param name from QueryParamProviderNew
options
prop to QueryParamProvider and argument to useQueryParam(s)enableBatching
option (i.e., multiple consecutive calls to setQueryParams in a row only result in a single update to the URL). This seems to work but would require updating the way all the tests are written to verify for sure, so marking as experimental for now.removeDefaultsFromUrl
(default: false). This happens on updates only, not on initial load. Requires the use of thedefault
attribute on a parameter to function (note serialize-query-params v2 withDefault now populates this).includeKnownParams
- in addition to those specified, also include all preconfigured parameters from the QueryParamProviderincludeAllParams
(default: false) - in addition to those specified, include all other parameters found in the current URLupdateType
(default “pushIn”) - the default update type when set is called.searchStringToObject, objectToSearchString
(default uses URLSearchParams) - equivalent ofparse
andstringify
from query-string.Parameters now can include
urlName
to automatically convert to a different name in the URL (e.g. { encode, decode, urlName })Caches decoded values across multiple hook calls from different components
Fixes
Stops reading from refs in render to prepare for future versions of React where this is not allowed.
Simplifies the way locations are updated by only passing in the search string as the new location.
v2.0.0-rc.1 Fix CJS imports of adapters (#224)
v2.0.0-rc.1 Be more defensive about reading updateType
Migrating from v1
There are two things you need to adjust to update from v1:
searchStringToObject
andobjectToSearchString
.Here's an example of the changes to complete both for React Router 5:
If you're using react-router-6, you'd import that adapter instead:
Note the
options
above are optional, but will retain the behavior you're used to from v1, which used query-string internally. If you want to switch to using URLSearchParams and not use query-string, you would do:Configuration
📅 Schedule: Branch creation - "after 11pm every weekday,every weekend,before 8am every weekday" in timezone Australia/Melbourne, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.