@etsoo/react 1.4.48 → 1.4.49

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.
@@ -18,10 +18,11 @@ export function ComboBox(props) {
18
18
  const isMounted = React.useRef(true);
19
19
  // When options change
20
20
  // [options] will cause infinite loop
21
+ const propertyWay = loadData == null;
21
22
  React.useEffect(() => {
22
- if (options != null)
23
+ if (propertyWay && options != null)
23
24
  setOptions(options);
24
- }, [JSON.stringify(options)]);
25
+ }, [JSON.stringify(options), propertyWay]);
25
26
  // Local default value
26
27
  let localValue = idValue != null
27
28
  ? localOptions.find((o) => Reflect.get(o, idField) === idValue)
@@ -17,10 +17,11 @@ export function SelectEx(props) {
17
17
  const isMounted = React.useRef(true);
18
18
  // When options change
19
19
  // [options] will cause infinite loop
20
+ const propertyWay = loadData == null;
20
21
  React.useEffect(() => {
21
- if (options != null)
22
+ if (propertyWay && options != null)
22
23
  setOptions(options);
23
- }, [JSON.stringify(options)]);
24
+ }, [JSON.stringify(options), propertyWay]);
24
25
  // Local value
25
26
  const valueSource = (_a = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value) !== null && _a !== void 0 ? _a : '';
26
27
  let localValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.48",
3
+ "version": "1.4.49",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -74,9 +74,10 @@ export function ComboBox<T extends {} = IdLabelDto>(props: ComboBoxProps<T>) {
74
74
 
75
75
  // When options change
76
76
  // [options] will cause infinite loop
77
+ const propertyWay = loadData == null;
77
78
  React.useEffect(() => {
78
- if (options != null) setOptions(options);
79
- }, [JSON.stringify(options)]);
79
+ if (propertyWay && options != null) setOptions(options);
80
+ }, [JSON.stringify(options), propertyWay]);
80
81
 
81
82
  // Local default value
82
83
  let localValue =
@@ -92,9 +92,10 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
92
92
 
93
93
  // When options change
94
94
  // [options] will cause infinite loop
95
+ const propertyWay = loadData == null;
95
96
  React.useEffect(() => {
96
- if (options != null) setOptions(options);
97
- }, [JSON.stringify(options)]);
97
+ if (propertyWay && options != null) setOptions(options);
98
+ }, [JSON.stringify(options), propertyWay]);
98
99
 
99
100
  // Local value
100
101
  const valueSource = defaultValue ?? value ?? '';