diff --git a/package.json b/package.json index 798ab9b6..7397258b 100644 --- a/package.json +++ b/package.json @@ -191,5 +191,8 @@ "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } + }, + "resolutions": { + "react-redux": "^7.2.0" } } diff --git a/packages/netlify-cms-core/package.json b/packages/netlify-cms-core/package.json index 27c773ca..890b04e3 100644 --- a/packages/netlify-cms-core/package.json +++ b/packages/netlify-cms-core/package.json @@ -29,6 +29,7 @@ "ajv": "^6.10.0", "ajv-errors": "^1.0.1", "ajv-keywords": "^3.4.1", + "connected-react-router": "^6.8.0", "copy-text-to-clipboard": "^2.0.0", "diacritics": "^1.3.0", "fuzzy": "^0.1.1", @@ -50,9 +51,8 @@ "react-is": "16.13.1", "react-modal": "^3.8.1", "react-polyglot": "^0.7.0", - "react-redux": "^5.1.1", + "react-redux": "^7.2.0", "react-router-dom": "^4.2.2", - "react-router-redux": "^5.0.0-alpha.8", "react-scroll-sync": "^0.6.0", "react-sortable-hoc": "^1.0.0", "react-split-pane": "^0.1.85", @@ -60,7 +60,7 @@ "react-virtualized-auto-sizer": "^1.0.2", "react-waypoint": "^8.1.0", "react-window": "^1.8.5", - "redux": "^4.0.1", + "redux": "^4.0.5", "redux-notifications": "^4.0.1", "redux-optimist": "^1.0.0", "redux-thunk": "^2.3.0", diff --git a/packages/netlify-cms-core/src/bootstrap.js b/packages/netlify-cms-core/src/bootstrap.js index cc9d3741..b537a329 100644 --- a/packages/netlify-cms-core/src/bootstrap.js +++ b/packages/netlify-cms-core/src/bootstrap.js @@ -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'; diff --git a/packages/netlify-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap b/packages/netlify-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap index ff24c9fa..11c2d4f9 100644 --- a/packages/netlify-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap +++ b/packages/netlify-cms-core/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap @@ -66,7 +66,8 @@ exports[`NestedCollection should render connected component 1`] = ` } { + return optimist( + combineReducers({ + ...reducers, + notifs: notifReducer, + router: connectRouter(history), + }), + ); +}; + +export default createRootReducer; diff --git a/packages/netlify-cms-core/src/redux/index.ts b/packages/netlify-cms-core/src/redux/index.ts index 6007f085..daca6a00 100644 --- a/packages/netlify-cms-core/src/redux/index.ts +++ b/packages/netlify-cms-core/src/redux/index.ts @@ -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( - reducer, + createRootReducer(history), compose( - applyMiddleware(thunkMiddleware as ThunkMiddleware, waitUntilAction), + applyMiddleware( + routerMiddleware(history), + thunkMiddleware as ThunkMiddleware, + waitUntilAction, + ), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : (f: Function): Function => f, diff --git a/yarn.lock b/yarn.lock index a6498496..3e8ffed7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5882,6 +5882,13 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== +connected-react-router@^6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/connected-react-router/-/connected-react-router-6.8.0.tgz#ddc687b31d498322445d235d660798489fa56cae" + integrity sha512-E64/6krdJM3Ag3MMmh2nKPtMbH15s3JQDuaYJvOVXzu6MbHbDyIvuwLOyhQIuP4Om9zqEfZYiVyflROibSsONg== + dependencies: + prop-types "^15.7.2" + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -6212,7 +6219,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-class@^15.5.1, create-react-class@^15.5.2: +create-react-class@^15.5.2: version "15.6.3" resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg== @@ -9629,7 +9636,7 @@ interpret@^2.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== -invariant@^2.0.0, invariant@^2.1.0, invariant@^2.2.2, invariant@^2.2.3, invariant@^2.2.4: +invariant@^2.1.0, invariant@^2.2.2, invariant@^2.2.3, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -14035,7 +14042,7 @@ react-inspector@^4.0.0: is-dom "^1.0.9" prop-types "^15.6.1" -react-is@16.13.1, react-is@^16.12.0, react-is@^16.6.0, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: +react-is@16.13.1, react-is@^16.12.0, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -14089,30 +14096,16 @@ react-popper@^1.3.7: typed-styles "^0.0.7" warning "^4.0.2" -react-redux@^4.0.0: - version "4.4.10" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-4.4.10.tgz#ad57bd1db00c2d0aa7db992b360ce63dd0b80ec5" - integrity sha512-tjL0Bmpkj75Td0k+lXlF8Fc8a9GuXFv/3ahUOCXExWs/jhsKiQeTffdH0j5byejCGCRL4tvGFYlrwBF1X/Aujg== +react-redux@^4.0.0, react-redux@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.0.tgz#f970f62192b3981642fec46fd0db18a074fe879d" + integrity sha512-EvCAZYGfOLqwV7gh849xy9/pt55rJXPwmYvI4lilPM5rUT/1NxuuN59ipdBksRVSvz0KInbPnp4IfoXJXCqiDA== dependencies: - create-react-class "^15.5.1" + "@babel/runtime" "^7.5.5" hoist-non-react-statics "^3.3.0" - invariant "^2.0.0" - lodash "^4.17.11" loose-envify "^1.4.0" prop-types "^15.7.2" - -react-redux@^5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.1.2.tgz#b19cf9e21d694422727bf798e934a916c4080f57" - integrity sha512-Ns1G0XXc8hDyH/OcBHOxNgQx9ayH3SPxBnFCOidGKSle8pKihysQw2rG/PmciUQRoclhVBO8HMhiRmGXnDja9Q== - dependencies: - "@babel/runtime" "^7.1.2" - hoist-non-react-statics "^3.3.0" - invariant "^2.2.4" - loose-envify "^1.1.0" - prop-types "^15.6.1" - react-is "^16.6.0" - react-lifecycles-compat "^3.0.0" + react-is "^16.9.0" react-router-dom@^4.2.2: version "4.3.1" @@ -14126,16 +14119,7 @@ react-router-dom@^4.2.2: react-router "^4.3.1" warning "^4.0.1" -react-router-redux@^5.0.0-alpha.8: - 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== @@ -14537,7 +14521,7 @@ redux-thunk@^2.3.0: resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622" integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw== -redux@^4.0.1: +redux@^4.0.1, redux@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f" integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==