Skip to content

Commit

Permalink
update redux middleware and composer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Nov 20, 2023
1 parent 642a9ca commit 804b0d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/store/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { persistStore, persistReducer, PersistConfig } from "redux-persist";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
import storage from "redux-persist/lib/storage";
import createSagaMiddleware from "redux-saga";
import { Environment, REACT_APP_ENV } from "@/shared/constants";
import { AppState } from "@/shared/interfaces";
import rootReducer from "./reducer";
import appSagas from "./saga";
Expand All @@ -40,12 +41,15 @@ let middleware: Array<Middleware>;
// eslint-disable-next-line @typescript-eslint/ban-types
let composer: Function;

if (process.env.NODE_ENV === "development") {
if (REACT_APP_ENV === Environment.Dev) {
middleware = [freeze, sagaMiddleware];
composer = composeWithDevTools({ trace: true, traceLimit: 25 });
} else {
middleware = [sagaMiddleware];
composer = compose;
composer =
REACT_APP_ENV === Environment.Production
? compose
: composeWithDevTools({ trace: true, traceLimit: 25 });
}

const errorHandlerMiddleware: Middleware =
Expand Down

0 comments on commit 804b0d9

Please sign in to comment.