From 80c03e128fca29decb6c464d6958207162b3600a Mon Sep 17 00:00:00 2001 From: Mathias Schopmans Date: Tue, 4 Apr 2017 09:04:25 +0200 Subject: [PATCH] Only reload once viewport changes --- js/client.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/client.js b/js/client.js index 9f15ea7..2651663 100644 --- a/js/client.js +++ b/js/client.js @@ -7,6 +7,7 @@ import createHistory from 'history/createBrowserHistory'; import App from './components/App'; import appReducer from './reducer'; import actions, { NAVIGATE } from './actions'; +import {isMobileViewport} from '../common/config' // Remove .html and map / to index const getPageNameFromPath = (path) => { @@ -37,10 +38,11 @@ const historyManager = store => { } let reloadTimeout; +let wasMobileViewport = isMobileViewport(); window.addEventListener('resize', function () { clearTimeout(reloadTimeout); reloadTimeout = setTimeout(() => { - window.location.reload(); + if (wasMobileViewport != isMobileViewport()) window.location.reload(); }, 200); });