Skip to content

feat(redux store): update deprecated createStore #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin-ui/app/components/App/AppMain.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
import { configureStore } from 'Redux/store'
import { configStore } from 'Redux/store'
import { PersistGate } from 'redux-persist/integration/react'
import AuthenticatedRouteSelector from './AuthenticatedRouteSelector'
const basePath = process.env.BASE_PATH || '/admin'

const AppMain = () => {
const { store, persistor } = configureStore()
const { store, persistor } = configStore()
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
Expand Down
14 changes: 7 additions & 7 deletions admin-ui/app/redux/store/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import { combineReducers } from 'redux'
import { configureStore } from '@reduxjs/toolkit'
import createSagaMiddleware from 'redux-saga'
import appReducers from '../reducers'
import RootSaga from '../sagas'
Expand All @@ -10,7 +11,6 @@ import process from 'Plugins/PluginReducersResolver'
// create the saga middleware
const sagaMiddleware = createSagaMiddleware()
const middlewares = [sagaMiddleware]
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const persistConfig = {
key: 'root',
storage,
Expand All @@ -30,12 +30,12 @@ const reducers = combine(reducerRegistry.getReducers())
process()
const persistedReducer = persistReducer(persistConfig, reducers)

export function configureStore(initialState) {
const store = createStore(
persistedReducer,
export function configStore(initialState) {
const store = configureStore({
middleware: middlewares,
reducer: persistedReducer,
initialState,
composeEnhancer(applyMiddleware(...middlewares)),
)
})
const persistor = persistStore(store)
window.dsfaStore = store
reducerRegistry.setChangeListener((reds) => {
Expand Down
1 change: 1 addition & 0 deletions admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@miltonbo/dashboard-style-airframe": "^0.2.0",
"@reduxjs/toolkit": "^1.8.2",
"ag-grid-community": "^21.0.1",
"ag-grid-react": "^21.0.1",
"axios": "^0.27.2",
Expand Down