From 63dab7a49618372ef261d3e83ab393c449d9b89d Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Mon, 22 May 2017 19:58:33 +0400 Subject: [PATCH] Fix going back when there's no state to pop --- ui/js/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/js/main.js b/ui/js/main.js index 1fa350eff..a67a021e9 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -40,11 +40,14 @@ window.addEventListener('popstate', (event, param) => { const pathParts = document.location.pathname.split('/') const route = '/' + pathParts[pathParts.length - 1] - if (route.match(/html$/)) return + let action + if (route.match(/html$/)) { + action = doChangePath('/discover') + } else { + action = doChangePath(`${route}${queryString}`) + } - console.log('title should be set here, but it is not in popstate? TODO') - - app.store.dispatch(doChangePath(`${route}${queryString}`)) + app.store.dispatch(action) }) ipcRenderer.on('open-uri-requested', (event, uri) => {