use-query-params
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -25,2 +25,3 @@ import * as React from 'react'; | ||
}, [location]); | ||
// TODO: we can probably simplify this now that we are reading location from history | ||
var getLocation = React.useCallback(function () { return locationRef.current; }, [ | ||
@@ -31,3 +32,5 @@ locationRef, | ||
// A ref is needed here to stop setLocation updating constantly (see #46) | ||
locationRef.current = createLocationWithChanges(queryReplacements, locationRef.current, updateType, stringifyOptions); | ||
locationRef.current = createLocationWithChanges(queryReplacements, history == null || history.location == null | ||
? locationRef.current | ||
: history.location, updateType, stringifyOptions); | ||
if (history) { | ||
@@ -34,0 +37,0 @@ updateUrlQuery(history, locationRef.current, updateType); |
@@ -13,2 +13,3 @@ import * as React from 'react'; | ||
}) => void; | ||
location: Location; | ||
} | ||
@@ -15,0 +16,0 @@ /** |
@@ -35,2 +35,5 @@ var __assign = (this && this.__assign) || function () { | ||
}, | ||
get location() { | ||
return window.location; | ||
}, | ||
}; | ||
@@ -61,2 +64,5 @@ cachedWindowHistory = history; | ||
}, | ||
get location() { | ||
return history.location; | ||
}, | ||
}; | ||
@@ -63,0 +69,0 @@ cachedReachHistory = history; |
@@ -18,2 +18,3 @@ import { QueryParamConfigMap, DecodedValueMap } from 'serialize-query-params'; | ||
replace: (location: Location) => void; | ||
location?: Location; | ||
} | ||
@@ -20,0 +21,0 @@ /** |
@@ -28,2 +28,3 @@ "use strict"; | ||
}, [location]); | ||
// TODO: we can probably simplify this now that we are reading location from history | ||
var getLocation = React.useCallback(function () { return locationRef.current; }, [ | ||
@@ -34,3 +35,5 @@ locationRef, | ||
// A ref is needed here to stop setLocation updating constantly (see #46) | ||
locationRef.current = updateUrlQuery_1.createLocationWithChanges(queryReplacements, locationRef.current, updateType, stringifyOptions); | ||
locationRef.current = updateUrlQuery_1.createLocationWithChanges(queryReplacements, history == null || history.location == null | ||
? locationRef.current | ||
: history.location, updateType, stringifyOptions); | ||
if (history) { | ||
@@ -37,0 +40,0 @@ updateUrlQuery_1.updateUrlQuery(history, locationRef.current, updateType); |
@@ -13,2 +13,3 @@ import * as React from 'react'; | ||
}) => void; | ||
location: Location; | ||
} | ||
@@ -15,0 +16,0 @@ /** |
@@ -37,2 +37,5 @@ "use strict"; | ||
}, | ||
get location() { | ||
return window.location; | ||
}, | ||
}; | ||
@@ -63,2 +66,5 @@ cachedWindowHistory = history; | ||
}, | ||
get location() { | ||
return history.location; | ||
}, | ||
}; | ||
@@ -65,0 +71,0 @@ cachedReachHistory = history; |
@@ -18,2 +18,3 @@ import { QueryParamConfigMap, DecodedValueMap } from 'serialize-query-params'; | ||
replace: (location: Location) => void; | ||
location?: Location; | ||
} | ||
@@ -20,0 +21,0 @@ /** |
{ | ||
"name": "use-query-params", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "React Hook for managing state in URL query parameters with easy serialization.", | ||
@@ -51,4 +51,7 @@ "main": "lib/index.js", | ||
"@testing-library/react-hooks": "^3.2.1", | ||
"@types/history": "^4.7.5", | ||
"@types/jest": "^24.0.11", | ||
"@types/react": "^16.8.25", | ||
"@types/react-router": "^5.1.7", | ||
"@types/react-router-dom": "^5.1.5", | ||
"@typescript-eslint/eslint-plugin": "^2.28.0", | ||
@@ -61,2 +64,3 @@ "@typescript-eslint/parser": "^2.2.0", | ||
"eslint-plugin-react-hooks": "^2.1.2", | ||
"history": "^4.10.1", | ||
"husky": "^3.0.5", | ||
@@ -69,2 +73,4 @@ "jest": "^25.3.0", | ||
"react-dom": "^16.9.0", | ||
"react-router": "^5.1.2", | ||
"react-router-dom": "^5.1.2", | ||
"react-test-renderer": "^16.9.0", | ||
@@ -71,0 +77,0 @@ "rimraf": "^3.0.2", |
@@ -485,3 +485,6 @@ <div align="center"> | ||
```js | ||
import { encodeQueryParams, NumberParam, stringify } from 'use-query-params'; | ||
import { encodeQueryParams, NumberParam } from 'use-query-params'; | ||
// since v1.0 stringify is not exported from 'use-query-params', | ||
// so you must install the 'query-string' package in case you need it | ||
import { stringify } from 'query-string'; | ||
@@ -488,0 +491,0 @@ // encode each parameter according to the configuration |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
92415
1568
576
32
3