shoc-frontend-new/src/lib/dialog-guard.ts

10 lines
304 B
TypeScript

/**
* Returns `undefined` as the dialog close handler while a mutation is pending,
* preventing backdrop click / ESC from dismissing the dialog.
*/
export function guardDialogClose(
isPending: boolean,
onClose: () => void,
): (() => void) | undefined {
return isPending ? undefined : onClose;
}