diff --git a/src/renderer/redux/actions/navigation.js b/src/renderer/redux/actions/navigation.js index b718936aa..a4cbca615 100644 --- a/src/renderer/redux/actions/navigation.js +++ b/src/renderer/redux/actions/navigation.js @@ -9,6 +9,7 @@ import { } from "redux/selectors/navigation"; import { doSearch } from "redux/actions/search"; import { toQueryString } from "util/query_params"; +import amplitude from "amplitude-js"; export function doNavigate(path, params = {}, options = {}) { return function(dispatch, getState) { @@ -23,6 +24,8 @@ export function doNavigate(path, params = {}, options = {}) { const scrollY = options.scrollY; + amplitude.getInstance().logEvent("NAVIGATION", { destination: url }); + dispatch({ type: types.HISTORY_NAVIGATE, data: { url, index: options.index, scrollY }, diff --git a/src/renderer/redux/reducers/navigation.js b/src/renderer/redux/reducers/navigation.js index e32658b76..2a4fbabdd 100644 --- a/src/renderer/redux/reducers/navigation.js +++ b/src/renderer/redux/reducers/navigation.js @@ -1,6 +1,5 @@ import * as types from "constants/action_types"; import { parseQueryParams } from "util/query_params"; -import amplitude from "amplitude-js"; const currentPath = () => { const hash = document.location.hash; @@ -71,13 +70,7 @@ reducers[types.WINDOW_SCROLLED] = (state, action) => { export default function reducer(state = defaultState, action) { const handler = reducers[action.type]; if (handler) { - let nextState = handler(state, action); - if (nextState.currentPath !== state.currentPath) { - amplitude - .getInstance() - .logEvent("NAVIGATION", { destination: nextState.currentPath }); - } - return nextState; + return handler(state, action); } return state; }