@ornikar/kitt-universal 25.55.0 → 25.56.0

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.es.js CHANGED
@@ -3652,6 +3652,8 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3652
3652
  isLoading = _useState2[0],
3653
3653
  setIsLoading = _useState2[1];
3654
3654
  var mountedRef = useRef(false);
3655
+ // securing the loading state with a ref to avoid user action between rerenders
3656
+ var loadingRef = useRef(false);
3655
3657
 
3656
3658
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3657
3659
  useEffect(function () {
@@ -3673,34 +3675,37 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3673
3675
  return _regeneratorRuntime().wrap(function (_context) {
3674
3676
  while (1) switch (_context.prev = _context.next) {
3675
3677
  case 0:
3676
- if (onPress) {
3678
+ if (!(!onPress || loadingRef.current)) {
3677
3679
  _context.next = 2;
3678
3680
  break;
3679
3681
  }
3680
3682
  return _context.abrupt("return");
3681
3683
  case 2:
3682
3684
  setIsLoading(true);
3683
- _context.prev = 3;
3684
- _context.next = 6;
3685
+ loadingRef.current = true;
3686
+ _context.prev = 4;
3687
+ _context.next = 7;
3685
3688
  return onPress(e);
3686
- case 6:
3689
+ case 7:
3687
3690
  if (mountedRef.current) {
3688
3691
  setIsLoading(false);
3692
+ loadingRef.current = false;
3689
3693
  }
3690
- _context.next = 13;
3694
+ _context.next = 14;
3691
3695
  break;
3692
- case 9:
3693
- _context.prev = 9;
3694
- _context.t0 = _context["catch"](3);
3696
+ case 10:
3697
+ _context.prev = 10;
3698
+ _context.t0 = _context["catch"](4);
3695
3699
  if (mountedRef.current) {
3700
+ loadingRef.current = false;
3696
3701
  setIsLoading(false);
3697
3702
  }
3698
3703
  throw _context.t0;
3699
- case 13:
3704
+ case 14:
3700
3705
  case "end":
3701
3706
  return _context.stop();
3702
3707
  }
3703
- }, _callee, null, [[3, 9]]);
3708
+ }, _callee, null, [[4, 10]]);
3704
3709
  }));
3705
3710
  return function () {
3706
3711
  return _ref2.apply(this, arguments);