@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/CHANGELOG.md +9 -0
- package/dist/definitions/Actions/ActionsItem.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +6 -1
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +6 -1
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-20.10.cjs.js +6 -1
- package/dist/index-node-20.10.cjs.js.map +1 -1
- package/dist/index-node-20.10.cjs.web.js +6 -1
- package/dist/index-node-20.10.cjs.web.js.map +1 -1
- package/dist/index-node-20.10.es.mjs +6 -1
- package/dist/index-node-20.10.es.mjs.map +1 -1
- package/dist/index-node-20.10.es.web.mjs +6 -1
- package/dist/index-node-20.10.es.web.mjs.map +1 -1
- package/dist/index.es.js +15 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +15 -10
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -3655,6 +3655,8 @@ const ActionsItem = /*#__PURE__*/React.forwardRef(({
|
|
|
3655
3655
|
}, ref) => {
|
|
3656
3656
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
3657
3657
|
const mountedRef = React.useRef(false);
|
|
3658
|
+
// securing the loading state with a ref to avoid user action between rerenders
|
|
3659
|
+
const loadingRef = React.useRef(false);
|
|
3658
3660
|
|
|
3659
3661
|
// effect just for tracking mounted state, as onPress can unmount the ActionButton
|
|
3660
3662
|
React.useEffect(() => {
|
|
@@ -3672,15 +3674,18 @@ const ActionsItem = /*#__PURE__*/React.forwardRef(({
|
|
|
3672
3674
|
icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
|
|
3673
3675
|
onPress: e => {
|
|
3674
3676
|
(async () => {
|
|
3675
|
-
if (!onPress) return;
|
|
3677
|
+
if (!onPress || loadingRef.current) return;
|
|
3676
3678
|
setIsLoading(true);
|
|
3679
|
+
loadingRef.current = true;
|
|
3677
3680
|
try {
|
|
3678
3681
|
await onPress(e);
|
|
3679
3682
|
if (mountedRef.current) {
|
|
3680
3683
|
setIsLoading(false);
|
|
3684
|
+
loadingRef.current = false;
|
|
3681
3685
|
}
|
|
3682
3686
|
} catch (error) {
|
|
3683
3687
|
if (mountedRef.current) {
|
|
3688
|
+
loadingRef.current = false;
|
|
3684
3689
|
setIsLoading(false);
|
|
3685
3690
|
}
|
|
3686
3691
|
throw error;
|