From f4e3e309b133eaaf290a5b51f1e568bbe7101d60 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Wed, 3 May 2023 03:39:06 +0900 Subject: [PATCH] [Glitch] use configureStore of redux-toolkit instead of createStore of redux Port 8227af8dcc5bfe5476da49202ffdffcf56204805 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/containers/mastodon.jsx | 3 +-- .../flavours/glitch/store/configureStore.js | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/javascript/flavours/glitch/containers/mastodon.jsx b/app/javascript/flavours/glitch/containers/mastodon.jsx index dd7623a813..aca7f4dc59 100644 --- a/app/javascript/flavours/glitch/containers/mastodon.jsx +++ b/app/javascript/flavours/glitch/containers/mastodon.jsx @@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import configureStore from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store/configureStore'; import UI from 'flavours/glitch/features/ui'; import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; import { hydrateStore } from 'flavours/glitch/actions/store'; @@ -20,7 +20,6 @@ addLocaleData(localeData); const title = process.env.NODE_ENV === 'production' ? siteTitle : `${siteTitle} (Dev)`; -export const store = configureStore(); const hydrateAction = hydrateStore(initialState); store.dispatch(hydrateAction); diff --git a/app/javascript/flavours/glitch/store/configureStore.js b/app/javascript/flavours/glitch/store/configureStore.js index 0e0d45c668..cb17dd9ce8 100644 --- a/app/javascript/flavours/glitch/store/configureStore.js +++ b/app/javascript/flavours/glitch/store/configureStore.js @@ -1,15 +1,16 @@ -import { createStore, applyMiddleware, compose } from 'redux'; +import { configureStore } from '@reduxjs/toolkit'; import thunk from 'redux-thunk'; import appReducer from '../reducers'; import loadingBarMiddleware from '../middleware/loading_bar'; import errorsMiddleware from '../middleware/errors'; import soundsMiddleware from '../middleware/sounds'; -export default function configureStore() { - return createStore(appReducer, compose(applyMiddleware( +export const store = configureStore({ + reducer: appReducer, + middleware: [ thunk, loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), errorsMiddleware(), soundsMiddleware(), - ), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f)); -} + ], +});