@etsoo/react 1.3.50 → 1.3.51
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/lib/mu/pages/CommonPage.js +12 -8
- package/package.json +1 -1
- package/src/mu/pages/CommonPage.tsx +13 -10
|
@@ -27,14 +27,17 @@ export function CommonPage(props) {
|
|
|
27
27
|
Object.assign(sx, {
|
|
28
28
|
padding: paddings
|
|
29
29
|
});
|
|
30
|
-
const
|
|
30
|
+
const [state] = React.useState({});
|
|
31
31
|
// Fab padding
|
|
32
32
|
const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
|
|
33
33
|
// Labels
|
|
34
34
|
const labels = Labels.CommonPage;
|
|
35
35
|
// Update
|
|
36
36
|
const update = onUpdateAll
|
|
37
|
-
?
|
|
37
|
+
? async (authorized) => {
|
|
38
|
+
await onUpdateAll(authorized);
|
|
39
|
+
state.loaded = true;
|
|
40
|
+
}
|
|
38
41
|
: onUpdate
|
|
39
42
|
? (authorized) => {
|
|
40
43
|
if (authorized == null || authorized)
|
|
@@ -46,16 +49,17 @@ export function CommonPage(props) {
|
|
|
46
49
|
onRefresh();
|
|
47
50
|
}
|
|
48
51
|
: undefined;
|
|
49
|
-
// onUpdateAll support to load after page mounted
|
|
50
|
-
if (onUpdateAll != null && isMounted.current) {
|
|
51
|
-
onUpdateAll();
|
|
52
|
-
}
|
|
53
52
|
React.useEffect(() => {
|
|
54
|
-
isMounted.current = true;
|
|
55
53
|
return () => {
|
|
56
|
-
|
|
54
|
+
state.loaded = false;
|
|
57
55
|
};
|
|
58
56
|
}, []);
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
// onUpdateAll support to load after page mounted
|
|
59
|
+
if (onUpdateAll != null && state.loaded) {
|
|
60
|
+
onUpdateAll();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
59
63
|
// Return the UI
|
|
60
64
|
return (React.createElement(React.Fragment, null,
|
|
61
65
|
update && React.createElement(ReactAppStateDetector, { update: update }),
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
50
50
|
padding: paddings
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const [state] = React.useState<{ loaded?: boolean }>({});
|
|
54
54
|
|
|
55
55
|
// Fab padding
|
|
56
56
|
const fabPadding = MUGlobal.increase(
|
|
@@ -63,7 +63,10 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
63
63
|
|
|
64
64
|
// Update
|
|
65
65
|
const update = onUpdateAll
|
|
66
|
-
?
|
|
66
|
+
? async (authorized?: boolean) => {
|
|
67
|
+
await onUpdateAll(authorized);
|
|
68
|
+
state.loaded = true;
|
|
69
|
+
}
|
|
67
70
|
: onUpdate
|
|
68
71
|
? (authorized?: boolean) => {
|
|
69
72
|
if (authorized == null || authorized) onUpdate();
|
|
@@ -74,19 +77,19 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
74
77
|
}
|
|
75
78
|
: undefined;
|
|
76
79
|
|
|
77
|
-
// onUpdateAll support to load after page mounted
|
|
78
|
-
if (onUpdateAll != null && isMounted.current) {
|
|
79
|
-
onUpdateAll();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
80
|
React.useEffect(() => {
|
|
83
|
-
isMounted.current = true;
|
|
84
|
-
|
|
85
81
|
return () => {
|
|
86
|
-
|
|
82
|
+
state.loaded = false;
|
|
87
83
|
};
|
|
88
84
|
}, []);
|
|
89
85
|
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
// onUpdateAll support to load after page mounted
|
|
88
|
+
if (onUpdateAll != null && state.loaded) {
|
|
89
|
+
onUpdateAll();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
90
93
|
// Return the UI
|
|
91
94
|
return (
|
|
92
95
|
<React.Fragment>
|