/** * 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; }