diff --git a/lib/routing.js b/lib/routing.js index af879e2..3dc8f9b 100644 --- a/lib/routing.js +++ b/lib/routing.js @@ -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)))