fix: update action start and end handlers to use explicit checks before calling

This commit is contained in:
Simon Larsen
2025-06-11 10:28:36 +01:00
parent d6d5ecec64
commit 2b801c3d08
2 changed files with 9 additions and 3 deletions

View File

@@ -225,7 +225,9 @@ const BulkUpdateForm: <T extends GenericObject>(
totalItems: props.selectedItems,
});
setActionInProgress(true);
props.onActionStart && props.onActionStart();
if (props.onActionStart) {
props.onActionStart();
}
},
onBulkActionEnd: () => {
setActionInProgress(false);
@@ -290,7 +292,9 @@ const BulkUpdateForm: <T extends GenericObject>(
submitButtonText="Close"
onSubmit={() => {
setShowProgressInfoModal(false);
props.onActionEnd && props.onActionEnd();
if (props.onActionEnd) {
props.onActionEnd();
}
}}
/>
)}

View File

@@ -97,7 +97,9 @@ const Button: FunctionComponent<ComponentProps> = ({
switch (event.key) {
case shortcutKey.toUpperCase():
case shortcutKey.toLowerCase():
onClick && onClick();
if (onClick) {
onClick();
}
return;
default:
return;