From 25bc16d87eaaa7e29dfa42ccf41a2c3b75a9ff7a Mon Sep 17 00:00:00 2001 From: "Bob.Hou" Date: Mon, 7 Sep 2026 07:56:36 -0400 Subject: [PATCH] fix(dashboard): batch delete no longer toasts failure after success (#12711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../fixes/12711-batch-delete-click-event.md | 2 + changelog.d/fixes/reset-aware-model-family.md | 2 +- .../[id]/hooks/useProviderConnections.ts | 5 +- src/shared/components/Modal.tsx | 2 +- stryker.conf.json | 1 + .../unit/ui/batch-delete-click-event.test.tsx | 159 ++++++++++++++++++ 6 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 changelog.d/fixes/12711-batch-delete-click-event.md create mode 100644 tests/unit/ui/batch-delete-click-event.test.tsx diff --git a/changelog.d/fixes/12711-batch-delete-click-event.md b/changelog.d/fixes/12711-batch-delete-click-event.md new file mode 100644 index 0000000000..617f97788d --- /dev/null +++ b/changelog.d/fixes/12711-batch-delete-click-event.md @@ -0,0 +1,2 @@ +- **fix(dashboard):** batch-deleting provider keys no longer toasts failure after a successful delete when the confirm button's click event is forwarded as `onAfter` ([#12711](https://github.com/diegosouzapw/OmniRoute/pull/12711)) +- **fix(glm):** drop the extra 16th argument to `createSSETransformStreamWithLogger` that TypeScript rejected (TS2554) and that never reached the TransformStream diff --git a/changelog.d/fixes/reset-aware-model-family.md b/changelog.d/fixes/reset-aware-model-family.md index 75b65e7613..09fa663182 100644 --- a/changelog.d/fixes/reset-aware-model-family.md +++ b/changelog.d/fixes/reset-aware-model-family.md @@ -1 +1 @@ -Keep Antigravity Gemini usable when the same connection's Claude weekly quota is empty; generic quota cache stays per-connection for every other provider. +- Keep Antigravity Gemini usable when the same connection's Claude weekly quota is empty; generic quota cache stays per-connection for every other provider. diff --git a/src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderConnections.ts b/src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderConnections.ts index 8caa9f7aac..6ae2dfe5c8 100644 --- a/src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderConnections.ts +++ b/src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderConnections.ts @@ -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")); diff --git a/src/shared/components/Modal.tsx b/src/shared/components/Modal.tsx index 8ecf9bb87b..3617d7d73f 100644 --- a/src/shared/components/Modal.tsx +++ b/src/shared/components/Modal.tsx @@ -275,7 +275,7 @@ export function ConfirmModal({ - diff --git a/stryker.conf.json b/stryker.conf.json index c8ff964e77..e28a90fa06 100644 --- a/stryker.conf.json +++ b/stryker.conf.json @@ -349,6 +349,7 @@ "tests/unit/repro-antigravity-404-family-cooldown-hijack.test.ts", "tests/unit/repro-combo-persisted-cooldown-preskip.test.ts", "tests/unit/repro-glm-iso-reset-24h-cap.test.ts", + "tests/unit/reset-aware-request-scope-12600.test.ts", "tests/unit/resilience-connections.test.ts", "tests/unit/responses-handler.test.ts", "tests/unit/responses-passthrough-openai-compatible.test.ts", diff --git a/tests/unit/ui/batch-delete-click-event.test.tsx b/tests/unit/ui/batch-delete-click-event.test.tsx new file mode 100644 index 0000000000..d599dbc605 --- /dev/null +++ b/tests/unit/ui/batch-delete-click-event.test.tsx @@ -0,0 +1,159 @@ +// @vitest-environment jsdom +/** + * ConfirmModal wires onConfirm to