[patch] Update dependency use-query-params to v2#222
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
b2f8c14 to
cf14607
Compare
e06a59a to
5d408f8
Compare
5d408f8 to
2b18fe9
Compare
2b18fe9 to
3e389b2
Compare
86b39a4 to
2c857b1
Compare
2c857b1 to
dd64b66
Compare
dd64b66 to
a4baa3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.0Release 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.2Compare Source
v2.1.1: v2.1.1Compare Source
v2.1.0: v2.1.0Compare Source
use-query-params v2.1.0 (August 31, 2022)
skipUpdateWhenNoChangedefaults 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 thesearchStringToObjectandobjectToSearchStringoptions 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
optionsprop to QueryParamProvider and argument to useQueryParam(s)enableBatchingoption (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 thedefaultattribute 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 ofparseandstringifyfrom query-string.Parameters now can include
urlNameto 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:
searchStringToObjectandobjectToSearchString.Here's an example of the changes to complete both for React Router 5:
import React from 'react'; import ReactDOM from 'react-dom'; import { QueryParamProvider } from 'use-query-params'; + import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; + import { parse, stringify } from 'query-string'; - import { BrowserRouter as Router, Route } from 'react-router-dom'; + import { BrowserRouter as Router } from 'react-router-dom'; import App from './App'; ReactDOM.render( <Router> - <QueryParamProvider ReactRouterRoute={Route}> + <QueryParamProvider + adapter={ReactRouter5Adapter} + options={{ + searchStringToObject: parse, + objectToSearchString: stringify, + }} + > <App /> </QueryParamProvider> </Router>, document.getElementById('root') );If you're using react-router-6, you'd import that adapter instead:
Note the
optionsabove 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:import React from 'react'; import ReactDOM from 'react-dom'; import { QueryParamProvider } from 'use-query-params'; + import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; - import { BrowserRouter as Router, Route } from 'react-router-dom'; + import { BrowserRouter as Router } from 'react-router-dom'; import App from './App'; ReactDOM.render( <Router> - <QueryParamProvider ReactRouterRoute={Route}> + <QueryParamProvider adapter={ReactRouter5Adapter}> <App /> </QueryParamProvider> </Router>, document.getElementById('root') );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.