@applicaster/quick-brick-core 15.1.4-alpha.7394150354 → 15.1.4-rc.0
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.
- package/App/ActionSetters/index.ts +15 -30
- package/package.json +8 -8
|
@@ -20,6 +20,10 @@ const warnUndefinedContext = (context) =>
|
|
|
20
20
|
data: { context },
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
+
type Subscription = {
|
|
24
|
+
[x: string]: () => any;
|
|
25
|
+
};
|
|
26
|
+
|
|
23
27
|
const getModuleContext = R.path(["module", "context"]);
|
|
24
28
|
|
|
25
29
|
const getContexts = R.compose(
|
|
@@ -59,43 +63,24 @@ const useSubscribeToActionProviders = () => {
|
|
|
59
63
|
export const useRiverInitialState = () => {
|
|
60
64
|
const key = "getRiverInitialState";
|
|
61
65
|
const actionProvidersSubscriptions = useSubscribeToActionProviders();
|
|
62
|
-
// Capture river-init promises once. Re-calling getRiverInitialState() on every
|
|
63
|
-
// context re-render causes thrash and can drop already-completed observables.
|
|
64
|
-
const capturedPromisesRef = React.useRef<Promise<unknown>[] | null>(null);
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
capturedPromisesRef.current === null &&
|
|
68
|
-
actionProvidersSubscriptions.length > 0
|
|
69
|
-
) {
|
|
70
|
-
const promises: Promise<unknown>[] = [];
|
|
71
|
-
let hasRiverInitMethod = false;
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
const subscriptions = React.useMemo(() => {
|
|
68
|
+
if (!actionProvidersSubscriptions.length) return undefined;
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
const
|
|
70
|
+
return actionProvidersSubscriptions.reduce((acc, item) => {
|
|
71
|
+
const riverInitialStatePromise = item[key]?.();
|
|
78
72
|
|
|
79
|
-
if (
|
|
80
|
-
|
|
73
|
+
if (riverInitialStatePromise) {
|
|
74
|
+
acc.push(riverInitialStatePromise);
|
|
81
75
|
}
|
|
82
|
-
}
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (promises.length > 0 || !hasRiverInitMethod) {
|
|
88
|
-
capturedPromisesRef.current = promises;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
77
|
+
return acc;
|
|
78
|
+
}, [] as Subscription[]);
|
|
79
|
+
}, [actionProvidersSubscriptions]);
|
|
91
80
|
|
|
92
|
-
if (!actionProvidersSubscriptions.length)
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
81
|
+
if (!actionProvidersSubscriptions.length) return undefined;
|
|
95
82
|
|
|
96
|
-
return
|
|
97
|
-
? undefined
|
|
98
|
-
: capturedPromisesRef.current;
|
|
83
|
+
return subscriptions;
|
|
99
84
|
};
|
|
100
85
|
|
|
101
86
|
const getActionInitialStateSetters = (key) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "15.1.4-
|
|
3
|
+
"version": "15.1.4-rc.0",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.1.4-
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "15.1.4-
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "15.1.4-
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "15.1.4-
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "15.1.4-
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "15.1.4-
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "15.1.4-
|
|
31
|
+
"@applicaster/applicaster-types": "15.1.4-rc.0",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "15.1.4-rc.0",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "15.1.4-rc.0",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "15.1.4-rc.0",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "15.1.4-rc.0",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "15.1.4-rc.0",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "15.1.4-rc.0",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|