repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

commit
7629481
parent
d9d816f
author
Vlad
date
2023-07-11 02:43:02 +0000 UTC
add enhancers to redux store (#3)

3 files changed,  +10, -1
M .gitignore
+1, -0
1@@ -4,3 +4,4 @@ node_modules/
2 npm/
3 .DS_Store
4 *.bak
5+.vscode
M deps.ts
+2, -0
 1@@ -40,9 +40,11 @@ export {
 2 export type {
 3   Action,
 4   AnyAction,
 5+  ConfigureEnhancersCallback,
 6   Middleware,
 7   Reducer,
 8   ReducersMapObject,
 9+  StoreEnhancer,
10 } from "https://esm.sh/@reduxjs/toolkit@1.9.5?pin=v122";
11 export {
12   combineReducers,
M redux/mod.ts
+7, -1
 1@@ -3,10 +3,12 @@ import {
 2   AnyAction,
 3   BATCH,
 4   Channel,
 5+  ConfigureEnhancersCallback,
 6   Middleware,
 7   Operation,
 8   ReducersMapObject,
 9   Scope,
10+  StoreEnhancer,
11 } from "../deps.ts";
12 import type { OpFn } from "../types.ts";
13 import {
14@@ -178,6 +180,7 @@ export function createFxMiddleware(scope: Scope = createScope()) {
15 interface SetupStoreProps<S = any> {
16   reducers: ReducersMapObject<S>;
17   middleware?: Middleware[];
18+  enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback;
19 }
20 
21 /**
22@@ -203,13 +206,16 @@ interface SetupStoreProps<S = any> {
23  * });
24  * ```
25  */
26-export function configureStore({ reducers, middleware = [] }: SetupStoreProps) {
27+export function configureStore(
28+  { reducers, middleware = [], enhancers = [] }: SetupStoreProps,
29+) {
30   const fx = createFxMiddleware();
31   const rootReducer = combineReducers({ ...queryReducers, ...reducers });
32   const store = reduxStore({
33     reducer: enableBatching(rootReducer),
34     middleware: (getDefaultMiddleware) =>
35       getDefaultMiddleware().concat([fx.middleware, ...middleware]),
36+    enhancers: enhancers,
37   });
38 
39   return { store, fx };