File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
redisinsight/ui/src/utils Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 11import { createBrowserHistory } from 'history'
22
3- import type { RootState , AppDispatch , ReduxStore } from 'uiSrc/slices/store'
3+ import type { ReduxStore } from 'uiSrc/slices/store'
44
55// Re-export all types and exports from the real store to avoid circular dependencies during tests
66
@@ -16,7 +16,7 @@ export const setStoreRef = (store: ReduxStore) => {
1616 storeRef = store
1717}
1818
19- const getState = ( ) : RootState => {
19+ const getState : ReduxStore [ 'getState' ] = ( ) => {
2020 if ( ! storeRef ) {
2121 throw new Error (
2222 'Store not initialized. Make sure store-dynamic is imported after store creation.' ,
@@ -25,7 +25,7 @@ const getState = (): RootState => {
2525 return storeRef . getState ( )
2626}
2727
28- const dispatch : AppDispatch = ( action : any ) => {
28+ const dispatch : ReduxStore [ 'dispatch' ] = ( action : any ) => {
2929 if ( ! storeRef ) {
3030 throw new Error (
3131 'Store not initialized. Make sure store-dynamic is imported after store creation.' ,
@@ -34,8 +34,18 @@ const dispatch: AppDispatch = (action: any) => {
3434 return storeRef . dispatch ( action )
3535}
3636
37+ const subscribe : ReduxStore [ 'subscribe' ] = ( listener : ( ) => void ) => {
38+ if ( ! storeRef ) {
39+ throw new Error (
40+ 'Store not initialized. Make sure store-dynamic is imported after store creation.' ,
41+ )
42+ }
43+ return storeRef . subscribe ( listener )
44+ }
45+
3746// Export store object that matches the real store interface
3847export const store = {
3948 getState,
4049 dispatch,
50+ subscribe,
4151}
You can’t perform that action at this time.
0 commit comments