magneto365.ui 2.65.3 → 2.65.4

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/dist/cjs/index.js CHANGED
@@ -7770,8 +7770,25 @@ var useSelect2 = function (_a) {
7770
7770
  }
7771
7771
  }, [searchValue, setTerm]);
7772
7772
  React.useEffect(function () {
7773
- if (!currentFields || !currentFields.length) {
7774
- setValueSelected([]);
7773
+ if (!currentFields) {
7774
+ if (valueSelected.length !== 0) {
7775
+ setValueSelected([]);
7776
+ }
7777
+ return;
7778
+ }
7779
+ if (!Array.isArray(currentFields)) {
7780
+ if ('id' in currentFields && 'name' in currentFields) {
7781
+ var newValue = [currentFields];
7782
+ if (JSON.stringify(valueSelected) !== JSON.stringify(newValue)) {
7783
+ setValueSelected(newValue);
7784
+ }
7785
+ }
7786
+ return;
7787
+ }
7788
+ if (currentFields.length === 0) {
7789
+ if (valueSelected.length !== 0) {
7790
+ setValueSelected([]);
7791
+ }
7775
7792
  return;
7776
7793
  }
7777
7794
  setValueSelected(function (prev) {
@@ -7780,7 +7797,7 @@ var useSelect2 = function (_a) {
7780
7797
  }
7781
7798
  return currentFields;
7782
7799
  });
7783
- }, [currentFields]);
7800
+ }, [currentFields, valueSelected]);
7784
7801
  React.useEffect(function () {
7785
7802
  if (limitSelections && valueSelected.length >= limitSelections) {
7786
7803
  setDisableList(true);