@portnet/ui 0.0.78 → 0.0.80
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.
|
@@ -193,14 +193,13 @@ const PuiFormikAutocomplete = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
193
193
|
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
194
194
|
}, [meta]);
|
|
195
195
|
React.useEffect(() => {
|
|
196
|
-
if (!Boolean(selectedOption) && value !== undefined && options !== undefined) {
|
|
196
|
+
if ((!Boolean(selectedOption) || getOptionValue(selectedOption) !== value) && value !== undefined && options !== undefined) {
|
|
197
197
|
let option;
|
|
198
198
|
if (typeof value === "object") {
|
|
199
199
|
option = value;
|
|
200
200
|
} else {
|
|
201
201
|
option = options.find(option => String(getOptionValue(option)) === String(value));
|
|
202
202
|
}
|
|
203
|
-
console.log("option", option);
|
|
204
203
|
setSelectedOption(option);
|
|
205
204
|
formikContext.setFieldValue(name, getOptionValue(option));
|
|
206
205
|
}
|
|
@@ -213,8 +212,7 @@ const PuiFormikAutocomplete = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
213
212
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
214
213
|
}, [field.value]);
|
|
215
214
|
React.useEffect(() => {
|
|
216
|
-
|
|
217
|
-
if (!Boolean(selectedOption) && field.value !== undefined && options !== undefined) {
|
|
215
|
+
if ((!Boolean(selectedOption) || getOptionValue(selectedOption) !== field.value) && field.value !== undefined && options !== undefined) {
|
|
218
216
|
let option;
|
|
219
217
|
if (typeof field.value === "object") {
|
|
220
218
|
option = field.value;
|