@etsoo/react 1.3.52 → 1.3.53
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.
|
@@ -27,7 +27,7 @@ export function CommonPage(props) {
|
|
|
27
27
|
Object.assign(sx, {
|
|
28
28
|
padding: paddings
|
|
29
29
|
});
|
|
30
|
-
const
|
|
30
|
+
const ref = React.useRef({});
|
|
31
31
|
// Fab padding
|
|
32
32
|
const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
|
|
33
33
|
// Labels
|
|
@@ -35,9 +35,9 @@ export function CommonPage(props) {
|
|
|
35
35
|
// Update
|
|
36
36
|
const update = onUpdateAll
|
|
37
37
|
? async (authorized) => {
|
|
38
|
-
|
|
38
|
+
ref.current.loading = true;
|
|
39
39
|
await onUpdateAll(authorized);
|
|
40
|
-
|
|
40
|
+
ref.current.firstLoaded = true;
|
|
41
41
|
}
|
|
42
42
|
: onUpdate
|
|
43
43
|
? (authorized) => {
|
|
@@ -52,17 +52,17 @@ export function CommonPage(props) {
|
|
|
52
52
|
: undefined;
|
|
53
53
|
React.useEffect(() => {
|
|
54
54
|
return () => {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
ref.current.loading = false;
|
|
56
|
+
ref.current.firstLoaded = false;
|
|
57
57
|
};
|
|
58
58
|
}, []);
|
|
59
59
|
React.useEffect(() => {
|
|
60
|
-
if (
|
|
61
|
-
|
|
60
|
+
if (ref.current.loading) {
|
|
61
|
+
ref.current.loading = false;
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
// onUpdateAll support to load after page loaded
|
|
65
|
-
if (onUpdateAll != null &&
|
|
65
|
+
if (onUpdateAll != null && ref.current.firstLoaded) {
|
|
66
66
|
onUpdateAll();
|
|
67
67
|
}
|
|
68
68
|
});
|
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 ref = React.useRef<{
|
|
54
54
|
firstLoaded?: boolean;
|
|
55
55
|
loading?: boolean;
|
|
56
56
|
}>({});
|
|
@@ -67,9 +67,9 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
67
67
|
// Update
|
|
68
68
|
const update = onUpdateAll
|
|
69
69
|
? async (authorized?: boolean) => {
|
|
70
|
-
|
|
70
|
+
ref.current.loading = true;
|
|
71
71
|
await onUpdateAll(authorized);
|
|
72
|
-
|
|
72
|
+
ref.current.firstLoaded = true;
|
|
73
73
|
}
|
|
74
74
|
: onUpdate
|
|
75
75
|
? (authorized?: boolean) => {
|
|
@@ -83,19 +83,19 @@ export function CommonPage(props: CommonPageProps) {
|
|
|
83
83
|
|
|
84
84
|
React.useEffect(() => {
|
|
85
85
|
return () => {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
ref.current.loading = false;
|
|
87
|
+
ref.current.firstLoaded = false;
|
|
88
88
|
};
|
|
89
89
|
}, []);
|
|
90
90
|
|
|
91
91
|
React.useEffect(() => {
|
|
92
|
-
if (
|
|
93
|
-
|
|
92
|
+
if (ref.current.loading) {
|
|
93
|
+
ref.current.loading = false;
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// onUpdateAll support to load after page loaded
|
|
98
|
-
if (onUpdateAll != null &&
|
|
98
|
+
if (onUpdateAll != null && ref.current.firstLoaded) {
|
|
99
99
|
onUpdateAll();
|
|
100
100
|
}
|
|
101
101
|
});
|