diff --git a/src/components/Home.js b/src/components/Home.js index 227fb2e6..f661f7a5 100644 --- a/src/components/Home.js +++ b/src/components/Home.js @@ -18,7 +18,10 @@ const Home = ({ appState, dispatch, router }) => { const handleMapClick = e => { const id = e.target.getAttribute('id') if (!id) return - dispatch(updateFilters({ place: slugify(stateLookup(id)) })) + + const placeNew = { place: slugify(stateLookup(id)) } + dispatch(updateFilters(placeNew)) + dispatch(updateApp({ crime, ...placeNew }, router)) } const handleSearchClick = () => { diff --git a/src/reducers/filters.js b/src/reducers/filters.js index 9c43bdf3..fc6b0128 100644 --- a/src/reducers/filters.js +++ b/src/reducers/filters.js @@ -2,6 +2,7 @@ import { FILTER_RESET, FILTERS_UPDATE } from '../actions/constants' const initialState = { + crime: 'violent-crime', since: 2004, until: 2014, } diff --git a/test/reducers/filters.test.js b/test/reducers/filters.test.js index 88a1fad0..d6191c4e 100644 --- a/test/reducers/filters.test.js +++ b/test/reducers/filters.test.js @@ -7,7 +7,7 @@ describe('filters', () => { describe('initial state', () => { it('should return a small object with time values', () => { const initialState = reducer(undefined, { type: 'fake' }) - expect(Object.keys(initialState).length).toEqual(2) + expect(Object.keys(initialState).length).toEqual(3) }) })