@etsoo/react 1.3.58 → 1.3.59

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,26 @@ 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
+ console.log('ReactAppStateDetector', changedFields, targetFields, matchedFields);
27
42
  // Ready
28
43
  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
- }
42
- console.log('ReactAppStateDetector', changedFields, targetFields, matchedFields);
43
44
  // Callback
44
- update(state.authorized, matchedFields);
45
- }, [state]);
45
+ update(authorized, matchedFields);
46
+ }, [authorized, matchedFields]);
46
47
  // return
47
48
  return React.createElement(React.Fragment);
48
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.3.58",
3
+ "version": "1.3.59",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -53,31 +53,32 @@ export function ReactAppStateDetector(props: IStateProps) {
53
53
  (globalApp.userState as UserState<IUser>).context
54
54
  );
55
55
 
56
- // Ready
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
- }
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
+ }
70
69
 
71
- console.log(
72
- 'ReactAppStateDetector',
73
- changedFields,
74
- targetFields,
75
- matchedFields
76
- );
70
+ console.log(
71
+ 'ReactAppStateDetector',
72
+ changedFields,
73
+ targetFields,
74
+ matchedFields
75
+ );
77
76
 
77
+ // Ready
78
+ React.useEffect(() => {
78
79
  // Callback
79
- update(state.authorized, matchedFields);
80
- }, [state]);
80
+ update(authorized, matchedFields);
81
+ }, [authorized, matchedFields]);
81
82
 
82
83
  // return
83
84
  return React.createElement(React.Fragment);