@common-stack/mobile-stack-react 6.0.6-alpha.15 → 6.0.6-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { Middleware,
|
|
1
|
+
import { Middleware, StoreEnhancer } from 'redux';
|
|
2
2
|
import { EpicMiddleware, Epic } from 'redux-observable';
|
|
3
3
|
import { PersistConfig } from 'redux-persist';
|
|
4
4
|
interface IReduxStore<S = any> {
|
|
5
5
|
scope: 'browser' | 'server' | 'native' | 'ElectronMain';
|
|
6
6
|
isDebug: boolean;
|
|
7
7
|
isDev: boolean;
|
|
8
|
-
reducers:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
reducers: any;
|
|
9
|
+
enhancers?: StoreEnhancer[];
|
|
10
|
+
rootEpic: Epic<any, any, any, any>;
|
|
11
|
+
epicMiddleware?: EpicMiddleware<any, any, S, any>;
|
|
11
12
|
preMiddleware?: Middleware[];
|
|
12
13
|
postMiddleware?: Middleware[];
|
|
13
14
|
middleware?: Middleware[];
|
|
14
|
-
initialState
|
|
15
|
-
persistConfig?: PersistConfig<
|
|
15
|
+
initialState?: any;
|
|
16
|
+
persistConfig?: PersistConfig<any>;
|
|
17
|
+
reduxConfig?: any;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Add any reducers required for this app dirctly in to
|
|
19
21
|
* `combineReducers`
|
|
20
22
|
*/
|
|
21
|
-
export declare const createReduxStore: ({ scope, isDebug, isDev, reducers, rootEpic, epicMiddleware, preMiddleware, postMiddleware, middleware, initialState, persistConfig, }: IReduxStore<any>) => import("redux").Store<any, import("redux").UnknownAction, unknown>;
|
|
23
|
+
export declare const createReduxStore: ({ scope, isDebug, isDev, reducers, rootEpic, enhancers, epicMiddleware, preMiddleware, postMiddleware, middleware, initialState, persistConfig, reduxConfig, }: IReduxStore<any>) => import("redux").Store<any, import("redux").UnknownAction, unknown>;
|
|
22
24
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {combineReducers,
|
|
1
|
+
import {combineReducers,configureStore}from'@reduxjs/toolkit';import {persistReducer,FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER}from'redux-persist';// version 11/12/2021
|
|
2
2
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
@@ -8,44 +8,42 @@ import {combineReducers,createStore,applyMiddleware,compose}from'redux';import {
|
|
|
8
8
|
* Add any reducers required for this app dirctly in to
|
|
9
9
|
* `combineReducers`
|
|
10
10
|
*/
|
|
11
|
-
const createReduxStore = ({ scope, isDebug, isDev, reducers, rootEpic, epicMiddleware, preMiddleware, postMiddleware, middleware
|
|
11
|
+
const createReduxStore = ({ scope, isDebug, isDev, reducers, rootEpic, enhancers = [], epicMiddleware, preMiddleware = [], postMiddleware = [], middleware = [], initialState, persistConfig, reduxConfig, }) => {
|
|
12
12
|
const isBrowser = scope === 'browser';
|
|
13
13
|
const isElectronMain = scope === 'ElectronMain';
|
|
14
|
+
const rootReducer = combineReducers(reducers);
|
|
15
|
+
const persistedReducer = persistConfig && isBrowser ? persistReducer(persistConfig, rootReducer) : rootReducer;
|
|
14
16
|
/**
|
|
15
17
|
* Add middleware that required for this app.
|
|
16
18
|
*/
|
|
17
|
-
const middlewares = [thunkMiddleware];
|
|
18
|
-
// add epicMiddleware
|
|
19
|
-
if (epicMiddleware) {
|
|
20
|
-
middlewares.push(epicMiddleware);
|
|
21
|
-
}
|
|
22
|
-
if (preMiddleware) {
|
|
23
|
-
middlewares.unshift(...preMiddleware);
|
|
24
|
-
}
|
|
25
19
|
// Add redux logger during development only
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
const middlewares = [
|
|
21
|
+
...preMiddleware,
|
|
22
|
+
...(epicMiddleware ? [epicMiddleware] : []),
|
|
23
|
+
...middleware,
|
|
24
|
+
...postMiddleware,
|
|
25
|
+
];
|
|
26
|
+
const store = configureStore({
|
|
27
|
+
reducer: persistedReducer,
|
|
28
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
29
|
+
serializableCheck: {
|
|
30
|
+
ignoredActions: [
|
|
31
|
+
FLUSH,
|
|
32
|
+
REHYDRATE,
|
|
33
|
+
PAUSE,
|
|
34
|
+
PERSIST,
|
|
35
|
+
PURGE,
|
|
36
|
+
REGISTER,
|
|
37
|
+
...(reduxConfig?.ignoredActions || []),
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}).concat(...middlewares),
|
|
41
|
+
devTools: isDev || isDebug,
|
|
42
|
+
preloadedState: initialState,
|
|
43
|
+
enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(...enhancers),
|
|
44
|
+
});
|
|
45
|
+
if ((isBrowser || isElectronMain) && epicMiddleware && rootEpic) {
|
|
46
|
+
epicMiddleware.run(rootEpic);
|
|
49
47
|
}
|
|
50
48
|
return store;
|
|
51
49
|
};export{createReduxStore};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/mobile-stack-react",
|
|
3
|
-
"version": "6.0.6-alpha.
|
|
3
|
+
"version": "6.0.6-alpha.17",
|
|
4
4
|
"description": "Client Module for mobile app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@apollo/client": "^3.9.0",
|
|
33
33
|
"@cdm-logger/client": "^9.0.3",
|
|
34
34
|
"@common-stack/client-core": "6.0.6-alpha.5",
|
|
35
|
-
"@common-stack/client-react": "6.0.6-alpha.
|
|
35
|
+
"@common-stack/client-react": "6.0.6-alpha.17",
|
|
36
36
|
"@common-stack/components-pro": "6.0.6-alpha.5",
|
|
37
37
|
"@common-stack/core": "6.0.6-alpha.5",
|
|
38
38
|
"@expo/vector-icons": "~13.0.0",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"typescript": {
|
|
132
132
|
"definition": "lib/index.d.ts"
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "1b4f4ebc9bf60f1d86ed9510e97f4cde1efab181"
|
|
135
135
|
}
|