@rpcbase/client 0.66.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hashState.js +4 -4
- package/package.json +1 -1
package/hashState.js
CHANGED
|
@@ -30,17 +30,17 @@ const parse_hash_str = (hash_str = window.location.hash) => {
|
|
|
30
30
|
// On first load, retrieve hashState from URL
|
|
31
31
|
const __initial_state = _omitBy(parse_hash_str(), _isNil)
|
|
32
32
|
|
|
33
|
-
export const
|
|
33
|
+
export const encodeHashState = (payload) =>
|
|
34
34
|
LZString.compressToEncodedURIComponent(JSON.stringify(payload))
|
|
35
35
|
|
|
36
36
|
// add payload to window hash
|
|
37
37
|
const apply_hash_state = (payload) => {
|
|
38
|
-
const str =
|
|
38
|
+
const str = encodeHashState(payload)
|
|
39
39
|
|
|
40
40
|
if (str === EMPTY_STATE_TOKEN) {
|
|
41
41
|
history.replaceState(null, null, window.location.pathname)
|
|
42
42
|
} else {
|
|
43
|
-
history.replaceState(null, null, `${window.location.pathname}#${
|
|
43
|
+
history.replaceState(null, null, `${window.location.pathname}#${encodeHashState(payload)}`)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -124,7 +124,7 @@ export const HashStateProvider = ({children}) => {
|
|
|
124
124
|
_isNil,
|
|
125
125
|
)
|
|
126
126
|
|
|
127
|
-
return
|
|
127
|
+
return encodeHashState(newState)
|
|
128
128
|
}, [])
|
|
129
129
|
|
|
130
130
|
return (
|