diff --git a/aiortc/package.json b/aiortc/package.json index f993dc237..2bf7b6a8b 100644 --- a/aiortc/package.json +++ b/aiortc/package.json @@ -21,13 +21,11 @@ "dev": "cross-env DEBUG=\"${DEBUG:='*'}\" PYTHON_LOG_TO_STDOUT=true ROOM_ID=devel node ./lib/index.js" }, "dependencies": { + "@reduxjs/toolkit": "^1.3.6", "debug": "^4.1.1", "fake-mediastreamtrack": "^1.1.3", "mediasoup-client-aiortc": "github:versatica/mediasoup-client-aiortc#v3", "protoo-client": "^4.0.3", - "redux": "^4.0.5", - "redux-logger": "^3.0.6", - "redux-thunk": "^2.3.0", "repl": "^0.1.3", "tsc-watch": "^4.1.0", "typescript": "^3.6.5", diff --git a/aiortc/src/index.ts b/aiortc/src/index.ts index e40b5f491..83400bbb7 100644 --- a/aiortc/src/index.ts +++ b/aiortc/src/index.ts @@ -1,22 +1,31 @@ import * as repl from 'repl'; -import { - applyMiddleware as applyReduxMiddleware, - createStore as createReduxStore -} from 'redux'; -import thunk from 'redux-thunk'; +import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'; import { Logger } from './Logger'; import { RoomClient } from './RoomClient'; -import reducers from './redux/reducers'; - -const reduxMiddlewares = [ thunk ]; +import room from './redux/reducers/room'; +import me from './redux/reducers/me'; +import producers from './redux/reducers/producers'; +import dataProducers from './redux/reducers/dataProducers'; +import peers from './redux/reducers/peers'; +import consumers from './redux/reducers/consumers'; +import dataConsumers from './redux/reducers/dataConsumers'; const logger = new Logger(); -const store = createReduxStore( - reducers, - undefined, - applyReduxMiddleware(...reduxMiddlewares) -); +const store = configureStore({ + reducer: { + room, + me, + producers, + dataProducers, + peers, + consumers, + dataConsumers + }, + middleware : getDefaultMiddleware({ + serializableCheck : false + }) +}); RoomClient.init({ store }); diff --git a/aiortc/src/redux/reducers/index.ts b/aiortc/src/redux/reducers/index.ts deleted file mode 100644 index ac16241d7..000000000 --- a/aiortc/src/redux/reducers/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { combineReducers } from 'redux'; -import room from './room'; -import me from './me'; -import producers from './producers'; -import dataProducers from './dataProducers'; -import peers from './peers'; -import consumers from './consumers'; -import dataConsumers from './dataConsumers'; - -const reducers = combineReducers( - { - room, - me, - producers, - dataProducers, - peers, - consumers, - dataConsumers - }); - -export default reducers; diff --git a/app/lib/index.jsx b/app/lib/index.jsx index 4da07c162..602fd7e93 100644 --- a/app/lib/index.jsx +++ b/app/lib/index.jsx @@ -3,14 +3,9 @@ import UrlParse from 'url-parse'; import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; -import { - applyMiddleware as applyReduxMiddleware, - createStore as createReduxStore -} from 'redux'; -import thunk from 'redux-thunk'; -// import { createLogger as createReduxLogger } from 'redux-logger'; import randomString from 'random-string'; import * as faceapi from 'face-api.js'; +import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'; import Logger from './Logger'; import * as utils from './utils'; import randomName from './randomName'; @@ -19,31 +14,35 @@ import RoomClient from './RoomClient'; import RoomContext from './RoomContext'; import * as cookiesManager from './cookiesManager'; import * as stateActions from './redux/stateActions'; -import reducers from './redux/reducers'; +import room from './redux/reducers/room'; +import me from './redux/reducers/me'; +import producers from './redux/reducers/producers'; +import dataProducers from './redux/reducers/dataProducers'; +import peers from './redux/reducers/peers'; +import consumers from './redux/reducers/consumers'; +import dataConsumers from './redux/reducers/dataConsumers'; +import notifications from './redux/reducers/notifications'; import Room from './components/Room'; const logger = new Logger(); -const reduxMiddlewares = [ thunk ]; - -// if (process.env.NODE_ENV === 'development') -// { -// const reduxLogger = createReduxLogger( -// { -// duration : true, -// timestamp : false, -// level : 'log', -// logErrors : true -// }); - -// reduxMiddlewares.push(reduxLogger); -// } let roomClient; -const store = createReduxStore( - reducers, - undefined, - applyReduxMiddleware(...reduxMiddlewares) -); + +const store = configureStore({ + reducer : { + room, + me, + producers, + dataProducers, + peers, + consumers, + dataConsumers, + notifications + }, + middleware : getDefaultMiddleware({ + serializableCheck : false + }) +}); window.STORE = store; diff --git a/app/lib/redux/reducers/index.js b/app/lib/redux/reducers/index.js deleted file mode 100644 index 7fcfbe73f..000000000 --- a/app/lib/redux/reducers/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import { combineReducers } from 'redux'; -import room from './room'; -import me from './me'; -import producers from './producers'; -import dataProducers from './dataProducers'; -import peers from './peers'; -import consumers from './consumers'; -import dataConsumers from './dataConsumers'; -import notifications from './notifications'; - -const reducers = combineReducers( - { - room, - me, - producers, - dataProducers, - peers, - consumers, - dataConsumers, - notifications - }); - -export default reducers; diff --git a/app/package.json b/app/package.json index d9b2d42e6..5339f403c 100644 --- a/app/package.json +++ b/app/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@babel/runtime": "^7.8.4", + "@reduxjs/toolkit": "^1.3.6", "bowser": "^2.9.0", "classnames": "^2.2.6", "clipboard-copy": "^3.1.0", @@ -33,9 +34,6 @@ "react-spinner": "^0.2.7", "react-tooltip": "^3.11.1", "react-transition-group": "^4.3.0", - "redux": "^4.0.5", - "redux-logger": "^3.0.6", - "redux-thunk": "^2.3.0", "riek": "^1.1.0", "url-parse": "^1.4.7" },