@shoplflow/base 0.24.16 → 0.24.17

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/index.cjs CHANGED
@@ -2847,6 +2847,7 @@ var InputButton = React2.forwardRef(
2847
2847
  var _b = _a, { value, defaultValue, onChange, onClick, isSelected, disabled = false, rightSource, onClear, width } = _b, rest = __objRest(_b, ["value", "defaultValue", "onChange", "onClick", "isSelected", "disabled", "rightSource", "onClear", "width"]);
2848
2848
  const [text, setText] = React2.useState("");
2849
2849
  const [isHovered, setIsHovered] = React2.useState(false);
2850
+ const prevValue = React2.useRef(value);
2850
2851
  const convertToString = React2.useCallback((value2) => {
2851
2852
  if (typeof value2 !== "number") {
2852
2853
  return typeof value2 === "string" ? value2 : value2.join("");
@@ -2879,9 +2880,13 @@ var InputButton = React2.forwardRef(
2879
2880
  }
2880
2881
  }, [convertToString, defaultValue]);
2881
2882
  React2.useEffect(() => {
2882
- if (value) {
2883
+ if (!(value === void 0 || value === null)) {
2884
+ if (prevValue.current === value) {
2885
+ return;
2886
+ }
2883
2887
  const convertString = convertToString(value);
2884
2888
  setText(convertString);
2889
+ prevValue.current = convertString;
2885
2890
  }
2886
2891
  }, [convertToString, value]);
2887
2892
  React2.useEffect(() => {