@@ -55,20 +55,40 @@ export const aiAssistBackend = window.ai_assist_backend;
5555
5656const isSingleClusterMode = `${ metaBackend } ` === 'undefined' ;
5757
58+ export interface ConfigureStoreOptions {
59+ aRootReducer ?: typeof rootReducer ;
60+ singleClusterMode ?: boolean ;
61+ api ?: YdbEmbeddedAPI ;
62+ additionalReducers ?: Record < string , Reducer > ;
63+ }
64+
5865export function configureStore ( {
5966 aRootReducer = rootReducer ,
6067 singleClusterMode = isSingleClusterMode ,
6168 api = new YdbEmbeddedAPI ( { webVersion, withCredentials : ! customBackend } ) ,
62- } = { } ) {
69+ additionalReducers = { } ,
70+ } : ConfigureStoreOptions = { } ) {
6371 ( { backend, basename, clusterName} = getUrlData ( {
6472 singleClusterMode,
6573 customBackend,
6674 } ) ) ;
6775 const history = createBrowserHistory ( { basename} ) ;
6876
69- const store = _configureStore ( aRootReducer , history , { singleClusterMode} , [
70- storeApi . middleware ,
71- ] ) ;
77+ // Merge root reducer with additional reducers
78+ const mergedReducer =
79+ Object . keys ( additionalReducers ) . length > 0
80+ ? {
81+ ...aRootReducer ,
82+ ...additionalReducers ,
83+ }
84+ : aRootReducer ;
85+
86+ const store = _configureStore (
87+ mergedReducer as typeof rootReducer ,
88+ history ,
89+ { singleClusterMode} ,
90+ [ storeApi . middleware ] ,
91+ ) ;
7292 listenForHistoryChange ( store , history ) ;
7393
7494 window . api = api ;
0 commit comments