feat: port release-v2 experience improvements from #6582 (audited subset) (#6609)

This commit is contained in:
Thomas authored and GitHub committed 2026-08-18 09:40:02 +02:00
1 parent e3a713d2df
commit e842177d9b
163 files changed
+7390 -1240

No files matched your search

+16 -12
View File
@@ -36,8 +36,8 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
const closeOnConfirm = innerProps.closeOnConfirm ?? true;
const closeOnCancel = innerProps.closeOnCancel ?? true;
const cancelLabel = labels?.cancel ?? ((t: TranslationFunction) => t("common.action.cancel"));
const confirmLabel = labels?.confirm ?? ((t: TranslationFunction) => t("common.action.confirm"));
const cancelLabel = labels?.cancel ?? ((translate: TranslationFunction) => translate("common.action.cancel"));
const confirmLabel = labels?.confirm ?? ((translate: TranslationFunction) => translate("common.action.confirm"));
const handleCancel = useCallback(
async (event: React.MouseEvent<HTMLButtonElement>) => {
@@ -59,19 +59,23 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
const handleConfirm = useCallback(
async (event: React.MouseEvent<HTMLButtonElement>) => {
setLoading(true);
try {
if (typeof confirmProps?.onClick === "function") {
await confirmProps.onClick(event);
}
if (typeof confirmProps?.onClick === "function") {
confirmProps.onClick(event);
}
if (typeof onConfirm === "function") {
await onConfirm();
}
if (typeof onConfirm === "function") {
await onConfirm();
if (closeOnConfirm) {
actions.closeModal();
}
} catch {
// Keep the modal open. Callers own action-specific error feedback.
} finally {
setLoading(false);
}
if (closeOnConfirm) {
actions.closeModal();
}
setLoading(false);
},
[confirmProps, onConfirm, closeOnConfirm, actions],
);