@etsoo/react 1.3.63 → 1.3.64

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.
@@ -24,25 +24,24 @@ export function ReactAppStateDetector(props) {
24
24
  const { state } = globalApp == null
25
25
  ? { state: {} }
26
26
  : React.useContext(globalApp.userState.context);
27
- // Match fields
28
- const authorized = state.authorized;
29
- const changedFields = state.lastChangedFields;
30
- let matchedFields;
31
- if (targetFields == null || changedFields == null) {
32
- matchedFields = changedFields;
33
- }
34
- else {
35
- matchedFields = [];
36
- targetFields.forEach((targetField) => {
37
- if (changedFields.includes(targetField))
38
- matchedFields === null || matchedFields === void 0 ? void 0 : matchedFields.push(targetField);
39
- });
40
- }
41
27
  // Ready
42
28
  React.useEffect(() => {
29
+ // Match fields
30
+ const changedFields = state.lastChangedFields;
31
+ let matchedFields;
32
+ if (targetFields == null || changedFields == null) {
33
+ matchedFields = changedFields;
34
+ }
35
+ else {
36
+ matchedFields = [];
37
+ targetFields.forEach((targetField) => {
38
+ if (changedFields.includes(targetField))
39
+ matchedFields === null || matchedFields === void 0 ? void 0 : matchedFields.push(targetField);
40
+ });
41
+ }
43
42
  // Callback
44
- update(authorized, matchedFields);
45
- }, [authorized, JSON.stringify(matchedFields !== null && matchedFields !== void 0 ? matchedFields : [])]);
43
+ update(state.authorized, matchedFields);
44
+ }, [state]);
46
45
  // return
47
46
  return React.createElement(React.Fragment);
48
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.3.63",
3
+ "version": "1.3.64",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -53,25 +53,24 @@ export function ReactAppStateDetector(props: IStateProps) {
53
53
  (globalApp.userState as UserState<IUser>).context
54
54
  );
55
55
 
56
- // Match fields
57
- const authorized = state.authorized;
58
- const changedFields = state.lastChangedFields;
59
- let matchedFields: string[] | undefined;
60
- if (targetFields == null || changedFields == null) {
61
- matchedFields = changedFields;
62
- } else {
63
- matchedFields = [];
64
- targetFields.forEach((targetField) => {
65
- if (changedFields.includes(targetField))
66
- matchedFields?.push(targetField);
67
- });
68
- }
69
-
70
56
  // Ready
71
57
  React.useEffect(() => {
58
+ // Match fields
59
+ const changedFields = state.lastChangedFields;
60
+ let matchedFields: string[] | undefined;
61
+ if (targetFields == null || changedFields == null) {
62
+ matchedFields = changedFields;
63
+ } else {
64
+ matchedFields = [];
65
+ targetFields.forEach((targetField) => {
66
+ if (changedFields.includes(targetField))
67
+ matchedFields?.push(targetField);
68
+ });
69
+ }
70
+
72
71
  // Callback
73
- update(authorized, matchedFields);
74
- }, [authorized, JSON.stringify(matchedFields ?? [])]);
72
+ update(state.authorized, matchedFields);
73
+ }, [state]);
75
74
 
76
75
  // return
77
76
  return React.createElement(React.Fragment);