diff options
| author | Andrei Mihailov <and.mikhaylov@gmail.com> | 2017-02-16 12:18:52 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-16 12:18:52 +0000 |
| commit | 4aaf7e0ddbbdf9a5e03fdbb20ecabe4866de96c3 (patch) | |
| tree | 8f7dfc5545c484472d3dc5138cddf6a810fa0558 /app/app.js | |
| parent | 5ba4a72e546747167e7ae815724ee2dd4b2ef8fb (diff) | |
| download | mullvadvpn-4aaf7e0ddbbdf9a5e03fdbb20ecabe4866de96c3.tar.xz mullvadvpn-4aaf7e0ddbbdf9a5e03fdbb20ecabe4866de96c3.zip | |
Feature/menubar popup window (#1)
Add menubar and tests
Diffstat (limited to 'app/app.js')
| -rw-r--r-- | app/app.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/app/app.js b/app/app.js index 6ac3ce492f..8789608887 100644 --- a/app/app.js +++ b/app/app.js @@ -3,21 +3,27 @@ import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { Router, hashHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; -import { remote, webFrame } from 'electron'; -import path from 'path'; +import { webFrame } from 'electron'; import routes from './routes'; import configureStore from './store'; -import Tray from './containers/Tray'; import Backend from './lib/backend'; const backend = new Backend(); -const iconPath = path.join(__dirname, 'assets/images/trayicon.png'); -const tray = new remote.Tray(iconPath); - const initialState = {}; const store = configureStore(initialState); -const routerHistory = syncHistoryWithStore(hashHistory, store); + +// desperately trying to fix https://github.com/reactjs/react-router-redux/issues/534 +hashHistory.replace('/'); + +// see https://github.com/reactjs/react-router-redux/issues/534 +const recentLocation = (store.getState().routing || {}).locationBeforeTransitions; +const routerHistory = syncHistoryWithStore(hashHistory, store, { adjustUrlOnReplay: true }); + +if(recentLocation && recentLocation.pathname) { + routerHistory.replace(recentLocation.pathname); +} + const rootElement = document.querySelector(document.currentScript.getAttribute('data-container')); // disable smart pinch. @@ -32,13 +38,8 @@ const createElement = (Component, props) => { }; ReactDOM.render( - <div> - <Provider store={ store }> - <Router history={ routerHistory } routes={ routes } createElement={ createElement } /> - </Provider> - <Provider store={ store }> - <Tray handle={ tray } backend={ backend } /> - </Provider> - </div>, + <Provider store={ store }> + <Router history={ routerHistory } routes={ routes } createElement={ createElement } /> + </Provider>, rootElement ); |
