Skip to content

Commit

Permalink
chore: upgrade query-string to ^8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dxsun97 committed Sep 10, 2023
1 parent 5412bb7 commit 35a05b3
Show file tree
Hide file tree
Showing 5 changed files with 1,115 additions and 697 deletions.
2 changes: 2 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default {
type: 'none',
exclude: [],
},
// https://github.com/alibaba/hooks/issues/2155
extraBabelIncludes: ['filter-obj'],
extraBabelPlugins: [
[
'babel-plugin-import',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"surge": "^0.21.3",
"ts-jest": "^29.0.5",
"typescript": "^5.1.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.10",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-merge": "^4.2.2"
},
"commitlint": {
Expand Down
2 changes: 1 addition & 1 deletion packages/use-url-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@babel/runtime": "^7.21.0",
"ahooks": "^3.4.1",
"query-string": "^6.9.0",
"query-string": "^8.1.0",
"tslib": "^2.4.1"
},
"gitHead": "11f6ad571bd365c95ecb9409ca3050cbbfc9b34a"
Expand Down
8 changes: 4 additions & 4 deletions packages/use-url-state/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemoizedFn, useUpdate } from 'ahooks';
import { parse, stringify } from 'query-string';
import qs from 'query-string';
import type { ParseOptions, StringifyOptions } from 'query-string';
import { useMemo, useRef } from 'react';
import type * as React from 'react';
Expand Down Expand Up @@ -50,7 +50,7 @@ const useUrlState = <S extends UrlState = UrlState>(
);

const queryFromUrl = useMemo(() => {
return parse(location.search, mergedParseOptions);
return qs.parse(location.search, mergedParseOptions);
}, [location.search]);

const targetQuery: State = useMemo(
Expand All @@ -71,7 +71,7 @@ const useUrlState = <S extends UrlState = UrlState>(
history[navigateMode](
{
hash: location.hash,
search: stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
search: qs.stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
},
location.state,
);
Expand All @@ -80,7 +80,7 @@ const useUrlState = <S extends UrlState = UrlState>(
navigate(
{
hash: location.hash,
search: stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
search: qs.stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
},
{
replace: navigateMode === 'replace',
Expand Down

0 comments on commit 35a05b3

Please sign in to comment.