mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-19 05:12:16 +03:00
fix(dashboard): batch delete no longer toasts failure after success (#12711)
Validado numa worktree combinada com as 16 PRs desta leva sobre `release/v3.8.51`: typecheck:core limpo, check-file-size e check-changelog-integrity OK, complexity 2788/3218 e cognitive 1261/1437 (ambos sob a baseline), ESLint 0 erros nos 152 arquivos alterados, 771 testes unitários focados, 49 de integração e a suíte vitest:ui completa (2149) verdes. Além do bug do toast, esta PR foi a que derrubou os três base-reds vivos do tip: o fragmento `changelog.d/fixes/reset-aware-model-family.md` sem o `- ` inicial, o registro do `tests/unit/reset-aware-request-scope-12600.test.ts` no `stryker.conf.json` e o `TS2554` do glm. O `check-changelog-integrity` voltou a passar aqui por causa dela. O diagnóstico do MouseEvent é o que dá o valor: `onConfirm` chegava como handler de clique nativo e `handleBatchDeleteConfirm` tratava qualquer primeiro argumento truthy como callback. O cinto (`typeof`) e o suspensório (o wrap no ConfirmModal) juntos estão certos — só um dos dois deixaria a porta aberta para o próximo caller.
This commit is contained in:
@@ -248,7 +248,7 @@ export interface UseProviderConnectionsReturn {
|
||||
export function useProviderConnections(
|
||||
providerId: string,
|
||||
isCompatible: boolean,
|
||||
isSearchProvider: boolean
|
||||
_isSearchProvider: boolean
|
||||
): UseProviderConnectionsReturn {
|
||||
const t = useTranslations("providers");
|
||||
const notify = useNotificationStore();
|
||||
@@ -844,7 +844,8 @@ export function useProviderConnections(
|
||||
setSelectedIds(new Set());
|
||||
await fetchConnections();
|
||||
notify.success(t("batchDeleteSuccess", { count }));
|
||||
if (onAfter) await onAfter();
|
||||
// ConfirmModal's onClick forwards a MouseEvent; only a real callback runs.
|
||||
if (typeof onAfter === "function") await onAfter();
|
||||
} else {
|
||||
const data = await res.json();
|
||||
notify.error(data.error || providerText(t, "batchDeleteFailed", "Batch delete failed"));
|
||||
|
||||
@@ -275,7 +275,7 @@ export function ConfirmModal({
|
||||
<Button variant="ghost" onClick={onClose} disabled={loading}>
|
||||
{resolvedCancelText}
|
||||
</Button>
|
||||
<Button variant={variant} onClick={onConfirm} loading={loading}>
|
||||
<Button variant={variant} onClick={() => void onConfirm()} loading={loading}>
|
||||
{resolvedConfirmText}
|
||||
</Button>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user