From 6e5d8cb780e4fb6a44c398f7dc00772743870720 Mon Sep 17 00:00:00 2001 From: tuliomir Date: Mon, 29 Apr 2024 15:00:55 -0300 Subject: [PATCH 1/2] chore: upgrades Redux --- package-lock.json | 52 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- src/store/index.js | 7 +++++-- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3327d7f4..de40eac2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@hathor/wallet-lib": "1.0.4", "@ledgerhq/hw-transport-node-hid": "6.28.1", + "@reduxjs/toolkit": "^2.1.0", "@sentry/electron": "3.0.7", "babel-polyfill": "6.26.0", "bootstrap": "4.6.1", @@ -31,7 +32,6 @@ "react-redux": "7.2.8", "react-router-dom": "^6.22.3", "react-scripts": "4.0.3", - "redux": "4.2.0", "redux-saga": "1.2.1", "redux-thunk": "2.4.1", "ttag": "1.8.6", @@ -3396,6 +3396,51 @@ "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.2.1.tgz", "integrity": "sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA==" }, + "node_modules/@reduxjs/toolkit": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.3.tgz", + "integrity": "sha512-76dll9EnJXg4EVcI5YNxZA/9hSAmZsFqzMmNRHvIlzw2WS/twfcVX3ysYrWGJMClwEmChQFC4yRq74tn6fdzRA==", + "dependencies": { + "immer": "^10.0.3", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.0.1" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/@reduxjs/toolkit/node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" + }, + "node_modules/@reduxjs/toolkit/node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "peerDependencies": { + "redux": "^5.0.0" + } + }, "node_modules/@remix-run/router": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz", @@ -21779,6 +21824,11 @@ "lodash": "^4.17.21" } }, + "node_modules/reselect": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.0.tgz", + "integrity": "sha512-aw7jcGLDpSgNDyWBQLv2cedml85qd95/iszJjN988zX1t7AVRJi19d9kto5+W7oCfQ94gyo40dVbT6g2k4/kXg==" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", diff --git a/package.json b/package.json index c7d8c451..193bcdea 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "dependencies": { "@hathor/wallet-lib": "1.0.4", "@ledgerhq/hw-transport-node-hid": "6.28.1", + "@reduxjs/toolkit": "^2.1.0", "@sentry/electron": "3.0.7", "babel-polyfill": "6.26.0", "bootstrap": "4.6.1", @@ -51,7 +52,6 @@ "react-redux": "7.2.8", "react-router-dom": "^6.22.3", "react-scripts": "4.0.3", - "redux": "4.2.0", "redux-saga": "1.2.1", "redux-thunk": "2.4.1", "ttag": "1.8.6", diff --git a/src/store/index.js b/src/store/index.js index dbaf0d43..187afb93 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import { createStore, applyMiddleware } from "redux"; +import { configureStore } from "@reduxjs/toolkit"; import thunk from 'redux-thunk'; import createSagaMiddleware from 'redux-saga'; import rootReducer from '../reducers/index'; @@ -15,7 +15,10 @@ import rootSagas from '../sagas'; const saga = createSagaMiddleware(); const middlewares = [saga, thunk]; -const store = createStore(rootReducer, applyMiddleware(...middlewares)); +const store = configureStore({ + reducer: rootReducer, + middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middlewares) +}); saga.run(rootSagas); From aa5fa4f891ba6654303bbc0f12e5dc3898e69924 Mon Sep 17 00:00:00 2001 From: tuliomir Date: Tue, 30 Apr 2024 13:24:39 -0300 Subject: [PATCH 2/2] fix: review adjustments --- package-lock.json | 2 +- package.json | 2 +- src/store/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index de40eac2..f84fd72d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@hathor/wallet-lib": "1.0.4", "@ledgerhq/hw-transport-node-hid": "6.28.1", - "@reduxjs/toolkit": "^2.1.0", + "@reduxjs/toolkit": "2.2.3", "@sentry/electron": "3.0.7", "babel-polyfill": "6.26.0", "bootstrap": "4.6.1", diff --git a/package.json b/package.json index 193bcdea..2f38ee0f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dependencies": { "@hathor/wallet-lib": "1.0.4", "@ledgerhq/hw-transport-node-hid": "6.28.1", - "@reduxjs/toolkit": "^2.1.0", + "@reduxjs/toolkit": "2.2.3", "@sentry/electron": "3.0.7", "babel-polyfill": "6.26.0", "bootstrap": "4.6.1", diff --git a/src/store/index.js b/src/store/index.js index 187afb93..6b650b6b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import { configureStore } from "@reduxjs/toolkit"; +import { configureStore } from '@reduxjs/toolkit'; import thunk from 'redux-thunk'; import createSagaMiddleware from 'redux-saga'; import rootReducer from '../reducers/index';