Skip to content

TagSpaces is an offline, open source, document manager with tagging support

remove react-router-redux && history (#1186)

Stanimirbb4169487bef
diff --git a/app/containers/LoginPage.tsx b/app/containers/LoginPage.tsx
index 97cc71243..fed27b9ee 100644
--- a/app/containers/LoginPage.tsx
+++ b/app/containers/LoginPage.tsx
@@ -20,7 +20,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import Button from '@material-ui/core/Button';
-import { history } from '../store/configureStore';
import i18n from '../services/i18n';
// import Backend from '../services/backend';
@@ -47,7 +46,7 @@ class LoginPage extends Component {
handleLogin = e => {
e.preventDefault(); // dev mode
- history.push('/');
+ // history.push('/');
};
render() {
diff --git a/app/containers/Root.tsx b/app/containers/Root.tsx
index bd64a9adc..ddcf6aba2 100644
--- a/app/containers/Root.tsx
+++ b/app/containers/Root.tsx
@@ -19,7 +19,7 @@
import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
-import { ConnectedRouter } from 'react-router-redux';
+import { BrowserRouter } from 'react-router-dom';
import Routes from '../routes';
import LoadingScreen from '../components/LoadingScreen';
import { actions as AppActions } from '../reducers/app';
@@ -37,7 +37,6 @@ import { getURLParameter } from '../utils/misc';
type RootType = {
store: {};
persistor: {};
- history: {};
};
function onBeforeLift(store) {
@@ -75,7 +74,7 @@ function onBeforeLift(store) {
}
}
-export default function Root({ store, persistor, history }: RootType) {
+export default function Root({ store, persistor }: RootType) {
return (
<Provider
// @ts-ignore
@@ -94,9 +93,9 @@ export default function Root({ store, persistor, history }: RootType) {
// @ts-ignore
persistor={persistor}
>
- <ConnectedRouter history={history}>
+ <BrowserRouter>
<Routes />
- </ConnectedRouter>
+ </BrowserRouter>
</PersistGate>
</Provider>
);
diff --git a/app/index.tsx b/app/index.tsx
index 5e79c1bcb..0ab906ab4 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -19,9 +19,8 @@
import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
-// import { push } from 'react-router-redux';
import Root from './containers/Root';
-import { configureStore, history } from './store/configureStore';
+import configureStore from './store/configureStore';
import './app.global.css';
const { store, persistor } = configureStore({});
@@ -36,7 +35,7 @@ if (process.env.NODE_ENV === 'production') {
render(
<AppContainer>
- <Root store={store} persistor={persistor} history={history} />
+ <Root store={store} persistor={persistor} />
</AppContainer>,
document.getElementById('root')
);
diff --git a/app/reducers/index.ts b/app/reducers/index.ts
index fb1188f54..9853dd4d7 100644
--- a/app/reducers/index.ts
+++ b/app/reducers/index.ts
@@ -16,7 +16,6 @@
*
*/
import { persistCombineReducers, PersistConfig } from 'redux-persist';
-import { routerReducer as router } from 'react-router-redux';
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
// import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
import storage from 'redux-persist/lib/storage';
@@ -106,7 +105,6 @@ const rootReducer = persistCombineReducers(rootPersistConfig, {
app,
locations: externalLocations ? () => externalLocations : locations,
taglibrary: externalTagLibrary ? () => externalTagLibrary : taglibrary,
- router,
locationIndex
});
diff --git a/app/store/configureStore.dev.ts b/app/store/configureStore.dev.ts
index 4eb7c28e4..2a96bc2c6 100644
--- a/app/store/configureStore.dev.ts
+++ b/app/store/configureStore.dev.ts
@@ -19,14 +19,10 @@
import { createStore, applyMiddleware, compose } from 'redux';
import { persistStore } from 'redux-persist';
import thunk from 'redux-thunk';
-import { createHashHistory } from 'history';
-import { routerMiddleware, routerActions } from 'react-router-redux';
import { createLogger } from 'redux-logger';
import rootReducer from '../reducers';
import onlineListener from '../services/onlineListener';
-const history = createHashHistory();
-
const configureStore = initialState => {
// Redux Configuration
const middleware = [];
@@ -42,13 +38,9 @@ const configureStore = initialState => {
});
middleware.push(logger);
- // Router Middleware
- const router = routerMiddleware(history);
- middleware.push(router);
-
// Redux DevTools Configuration
const actionCreators = {
- ...routerActions
+ // ...routerActions
};
// If Redux DevTools Extension is installed use it, otherwise use Redux compose
/* eslint-disable no-underscore-dangle */
@@ -88,4 +80,4 @@ const configureStore = initialState => {
return { store, persistor };
};
-export default { configureStore, history };
+export default { configureStore };
diff --git a/app/store/configureStore.prod.ts b/app/store/configureStore.prod.ts
index 42a96711b..be7358f7d 100644
--- a/app/store/configureStore.prod.ts
+++ b/app/store/configureStore.prod.ts
@@ -19,15 +19,11 @@
import { compose, createStore, applyMiddleware } from 'redux';
import { persistStore } from 'redux-persist';
import thunk from 'redux-thunk';
-import { createBrowserHistory } from 'history';
-import { routerMiddleware } from 'react-router-redux';
import rootReducer from '../reducers';
import onlineListener from '../services/onlineListener';
-const history = createBrowserHistory();
-const router = routerMiddleware(history);
const enhancer = compose(
- applyMiddleware(thunk, router)
+ applyMiddleware(thunk) // , router)
// autoRehydrate()
);
@@ -42,4 +38,4 @@ function configureStore(initialState) {
return { store, persistor };
}
-export default { configureStore, history };
+export default { configureStore };
diff --git a/app/store/configureStore.ts b/app/store/configureStore.ts
index 2e12a414f..6faef057c 100644
--- a/app/store/configureStore.ts
+++ b/app/store/configureStore.ts
@@ -22,7 +22,5 @@ const selectedConfigureStore =
process.env.NODE_ENV === 'production'
? configureStoreProd
: configureStoreDev;
-
-export const { configureStore } = selectedConfigureStore;
-
-export const { history } = selectedConfigureStore;
+const { configureStore } = selectedConfigureStore;
+export default configureStore;
diff --git a/package.json b/package.json
index 8ac78411d..5d8b3e88b 100644
--- a/package.json
+++ b/package.json
@@ -245,7 +245,6 @@
"fs-extra": "^4.0.1",
"fuse.js": "^6.4.1",
"geolocation-utils": "^1.2.1",
- "history": "^4.7.2",
"html2canvas": "^1.0.0-alpha.12",
"i18next": "^11.3.3",
"i18next-browser-languagedetector": "^2.0.0",
@@ -274,7 +273,6 @@
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
- "react-router-redux": "^5.0.0-alpha.6",
"react-split-pane": "https://github.com/quarkw/react-split-pane",
"react-swipeable-views": "0.13.3",
"react-virtualized": "^9.21.1",
diff --git a/yarn.lock b/yarn.lock
index bd8badc28..45764b25c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -12695,16 +12695,7 @@ react-router-dom@^4.3.1:
react-router "^4.3.1"
warning "^4.0.1"
-react-router-redux@^5.0.0-alpha.6:
- version "5.0.0-alpha.9"
- resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-5.0.0-alpha.9.tgz#825431516e0e6f1fd93b8807f6bd595e23ec3d10"
- integrity sha512-euSgNIANnRXr4GydIuwA7RZCefrLQzIw5WdXspS8NPYbV+FxrKSS9MKG7U9vb6vsKHONnA4VxrVNWfnMUnUQAw==
- dependencies:
- history "^4.7.2"
- prop-types "^15.6.0"
- react-router "^4.2.0"
-
-react-router@^4.2.0, react-router@^4.3.1:
+react-router@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e"
integrity sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==