chore: replace react-router-redux with connected-react-router (#4001)
This commit is contained in:
2
packages/netlify-cms-core/src/bootstrap.js
vendored
2
packages/netlify-cms-core/src/bootstrap.js
vendored
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import { Route } from 'react-router-dom';
|
||||
import { ConnectedRouter } from 'react-router-redux';
|
||||
import { ConnectedRouter } from 'connected-react-router';
|
||||
import history from 'Routing/history';
|
||||
import store from 'ReduxStore';
|
||||
import { mergeConfig } from 'Actions/config';
|
||||
|
@ -66,7 +66,8 @@ exports[`NestedCollection should render connected component 1`] = `
|
||||
}
|
||||
|
||||
<a
|
||||
class="emotion-6 emotion-7"
|
||||
aria-current="page"
|
||||
class="emotion-6 emotion-7 sidebar-active"
|
||||
data-testid="/"
|
||||
depth="0"
|
||||
href="/collections/pages"
|
||||
|
@ -1,13 +1,17 @@
|
||||
import { combineReducers } from 'redux';
|
||||
import { routerReducer } from 'react-router-redux';
|
||||
import { connectRouter } from 'connected-react-router';
|
||||
import { reducer as notifReducer } from 'redux-notifications';
|
||||
import optimist from 'redux-optimist';
|
||||
import reducers from './index';
|
||||
|
||||
export default optimist(
|
||||
combineReducers({
|
||||
...reducers,
|
||||
notifs: notifReducer,
|
||||
routing: routerReducer,
|
||||
}),
|
||||
);
|
||||
const createRootReducer = history => {
|
||||
return optimist(
|
||||
combineReducers({
|
||||
...reducers,
|
||||
notifs: notifReducer,
|
||||
router: connectRouter(history),
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
export default createRootReducer;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { createStore, applyMiddleware, compose, AnyAction } from 'redux';
|
||||
import thunkMiddleware, { ThunkMiddleware } from 'redux-thunk';
|
||||
import { routerMiddleware } from 'connected-react-router';
|
||||
import { waitUntilAction } from './middleware/waitUntilAction';
|
||||
import reducer from '../reducers/combinedReducer';
|
||||
import createRootReducer from '../reducers/combinedReducer';
|
||||
import history from '../routing/history';
|
||||
import { State } from '../types/redux';
|
||||
|
||||
declare global {
|
||||
@ -12,9 +14,13 @@ declare global {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const store = createStore<State, any, {}, {}>(
|
||||
reducer,
|
||||
createRootReducer(history),
|
||||
compose(
|
||||
applyMiddleware(thunkMiddleware as ThunkMiddleware<State, AnyAction>, waitUntilAction),
|
||||
applyMiddleware(
|
||||
routerMiddleware(history),
|
||||
thunkMiddleware as ThunkMiddleware<State, AnyAction>,
|
||||
waitUntilAction,
|
||||
),
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||
: (f: Function): Function => f,
|
||||
|
Reference in New Issue
Block a user