remove empty state values so as not to override defaults

main
briandennis 7 years ago committed by Brian Dennis
parent 5a11b115e0
commit 5af953cd2e

@ -44,7 +44,16 @@ const keysToQuery = keys =>
.map(key => `${key}=${keys[key]}`)
.join('&')}`
export const getQueryStringState = query => mapper.map(mappings, query)
export const getQueryStringState = query => {
const state = mapper.map(mappings, query)
Object.keys(state).forEach(key => {
if (state[key] === '') state[key] = undefined
})
return state
}
export const updateQueryString = state =>
history.replace({
search: encodeURI(keysToQuery(mapper.map(reverseMappings, state)))

Loading…
Cancel
Save