|
|
@ -80,7 +80,6 @@ export const getQueryStringState = query => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const state = mapper.map(mappings, query)
|
|
|
|
const state = mapper.map(mappings, query)
|
|
|
|
deserializeCode(state)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(state).forEach(key => {
|
|
|
|
Object.keys(state).forEach(key => {
|
|
|
|
if (state[key] === '') state[key] = undefined
|
|
|
|
if (state[key] === '') state[key] = undefined
|
|
|
@ -92,19 +91,9 @@ export const getQueryStringState = query => {
|
|
|
|
export const updateQueryString = state => {
|
|
|
|
export const updateQueryString = state => {
|
|
|
|
if (history.location.search.indexOf('react_perf') < 0) {
|
|
|
|
if (history.location.search.indexOf('react_perf') < 0) {
|
|
|
|
const mappedState = mapper.map(reverseMappings, state)
|
|
|
|
const mappedState = mapper.map(reverseMappings, state)
|
|
|
|
serializeCode(mappedState)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
history.replace({
|
|
|
|
history.replace({
|
|
|
|
search: encodeURI(keysToQuery(mappedState))
|
|
|
|
search: encodeURIComponent(keysToQuery(mappedState))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// private
|
|
|
|
|
|
|
|
function serializeCode(state) {
|
|
|
|
|
|
|
|
if (state.code) state.code = encodeURIComponent(state.code)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function deserializeCode(state) {
|
|
|
|
|
|
|
|
if (state.code) state.code = decodeURIComponent(state.code)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|