100 lines
3.7 KiB
TypeScript
100 lines
3.7 KiB
TypeScript
// import { combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
// import { persistStore, persistReducer } from 'redux-persist';
|
|
// import storage from 'redux-persist/lib/storage';
|
|
|
|
// // Ensure proper imports
|
|
// import userReducer from "./slices/userSlice";
|
|
// import selectedDocsReducer from "./slices/selectedDocsSlice";
|
|
// import loaderReducer from "./slices/loaderSlice";
|
|
// import modalReducer from "./slices/modalSlice";
|
|
// import selectedRecipientsReducer from "./slices/selectedRecipientsSlice";
|
|
// import documentReducer from "./slices/documentSlice";
|
|
// import tagsReducer from "./slices/tagsSlice";
|
|
// import transactionReducer from "./slices/transactionSlice";
|
|
// import signatureReducer from "./slices/signatureSlice";
|
|
|
|
// // Generate a unique key for this tab
|
|
// const uniqueTabKey = sessionStorage.getItem('tabId') || Math.random().toString(36).substr(2, 9);
|
|
// if (!sessionStorage.getItem('tabId')) {
|
|
// sessionStorage.setItem('tabId', uniqueTabKey);
|
|
// }
|
|
|
|
// // Persist configuration for `user` (shared across all tabs)
|
|
// const userPersistConfig = {
|
|
// key: 'root-user',
|
|
// storage,
|
|
// };
|
|
|
|
// // Persist configuration for other slices (unique key per tab)
|
|
// const otherPersistConfig = (key) => ({
|
|
// key: `root-${key}-${uniqueTabKey}`,
|
|
// storage,
|
|
// });
|
|
|
|
// const rootReducer = combineReducers({
|
|
// user: persistReducer(userPersistConfig, userReducer),
|
|
// documents: persistReducer(otherPersistConfig('documents'), documentReducer),
|
|
// selectedDocuments: persistReducer(otherPersistConfig('selectedDocuments'), selectedDocsReducer),
|
|
// loader: persistReducer(otherPersistConfig('loader'), loaderReducer),
|
|
// modal: persistReducer(otherPersistConfig('modal'), modalReducer),
|
|
// selectedRecipients: persistReducer(otherPersistConfig('selectedRecipients'), selectedRecipientsReducer),
|
|
// tags: persistReducer(otherPersistConfig('tags'), tagsReducer),
|
|
// transaction: persistReducer(otherPersistConfig('transaction'), transactionReducer),
|
|
// signature: persistReducer(otherPersistConfig('signature'), signatureReducer),
|
|
// });
|
|
|
|
// const persistedReducer = rootReducer;
|
|
|
|
// export const store = configureStore({
|
|
// reducer: persistedReducer,
|
|
// devTools: import.meta.env.VITE_NODE_ENV !== "production" || true,
|
|
// middleware: (getDefaultMiddleware) =>
|
|
// getDefaultMiddleware({
|
|
// serializableCheck: false,
|
|
// }),
|
|
// });
|
|
|
|
// export const persistor = persistStore(store);
|
|
|
|
// export type RootState = ReturnType<typeof store.getState>;
|
|
// export type AppDispatch = typeof store.dispatch;
|
|
|
|
|
|
import { combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
|
|
// Reducers
|
|
import userReducer from "./slices/userSlice";
|
|
import selectedDocsReducer from "./slices/selectedDocsSlice";
|
|
import loaderReducer from "./slices/loaderSlice";
|
|
import modalReducer from "./slices/modalSlice";
|
|
import selectedRecipientsReducer from "./slices/selectedRecipientsSlice";
|
|
import documentReducer from "./slices/documentSlice";
|
|
import tagsReducer from "./slices/tagsSlice";
|
|
import transactionReducer from "./slices/transactionSlice";
|
|
import signatureReducer from "./slices/signatureSlice";
|
|
|
|
const rootReducer = combineReducers({
|
|
user: userReducer,
|
|
documents: documentReducer,
|
|
selectedDocuments: selectedDocsReducer,
|
|
loader: loaderReducer,
|
|
modal: modalReducer,
|
|
selectedRecipients: selectedRecipientsReducer,
|
|
tags: tagsReducer,
|
|
transaction: transactionReducer,
|
|
signature: signatureReducer,
|
|
});
|
|
|
|
export const store = configureStore({
|
|
reducer: rootReducer,
|
|
devTools: import.meta.env.VITE_NODE_ENV !== "production" || true,
|
|
middleware: (getDefaultMiddleware) =>
|
|
getDefaultMiddleware({
|
|
serializableCheck: false,
|
|
}),
|
|
});
|
|
|
|
|
|
export type RootState = ReturnType<typeof store.getState>;
|
|
export type AppDispatch = typeof store.dispatch;
|