@etsoo/react 1.4.46 → 1.4.47
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/ComboBox.js +4 -0
- package/lib/mu/SelectEx.js +4 -0
- package/package.json +2 -2
- package/src/mu/ComboBox.tsx +5 -0
- package/src/mu/SelectEx.tsx +5 -0
package/lib/mu/ComboBox.js
CHANGED
|
@@ -16,6 +16,10 @@ export function ComboBox(props) {
|
|
|
16
16
|
// Options state
|
|
17
17
|
const [localOptions, setOptions] = React.useState(options);
|
|
18
18
|
const isMounted = React.useRef(true);
|
|
19
|
+
// When options change
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
setOptions(options);
|
|
22
|
+
}, [options]);
|
|
19
23
|
// Local default value
|
|
20
24
|
let localValue = idValue != null
|
|
21
25
|
? localOptions.find((o) => Reflect.get(o, idField) === idValue)
|
package/lib/mu/SelectEx.js
CHANGED
|
@@ -15,6 +15,10 @@ export function SelectEx(props) {
|
|
|
15
15
|
// Options state
|
|
16
16
|
const [localOptions, setOptions] = React.useState(options);
|
|
17
17
|
const isMounted = React.useRef(true);
|
|
18
|
+
// When options change
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
setOptions(options);
|
|
21
|
+
}, [options]);
|
|
18
22
|
// Local value
|
|
19
23
|
const valueSource = (_a = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value) !== null && _a !== void 0 ? _a : '';
|
|
20
24
|
let localValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.47",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@types/react-test-renderer": "^17.0.1",
|
|
86
86
|
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
|
87
87
|
"@typescript-eslint/parser": "^5.9.1",
|
|
88
|
-
"eslint": "^8.
|
|
88
|
+
"eslint": "^8.7.0",
|
|
89
89
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
90
90
|
"eslint-plugin-import": "^2.25.4",
|
|
91
91
|
"eslint-plugin-react": "^7.28.0",
|
package/src/mu/ComboBox.tsx
CHANGED
|
@@ -72,6 +72,11 @@ export function ComboBox<T extends {} = IdLabelDto>(props: ComboBoxProps<T>) {
|
|
|
72
72
|
const [localOptions, setOptions] = React.useState(options);
|
|
73
73
|
const isMounted = React.useRef(true);
|
|
74
74
|
|
|
75
|
+
// When options change
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
setOptions(options);
|
|
78
|
+
}, [options]);
|
|
79
|
+
|
|
75
80
|
// Local default value
|
|
76
81
|
let localValue =
|
|
77
82
|
idValue != null
|
package/src/mu/SelectEx.tsx
CHANGED
|
@@ -90,6 +90,11 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
|
|
|
90
90
|
const [localOptions, setOptions] = React.useState(options);
|
|
91
91
|
const isMounted = React.useRef(true);
|
|
92
92
|
|
|
93
|
+
// When options change
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
setOptions(options);
|
|
96
|
+
}, [options]);
|
|
97
|
+
|
|
93
98
|
// Local value
|
|
94
99
|
const valueSource = defaultValue ?? value ?? '';
|
|
95
100
|
let localValue: unknown | unknown[];
|