feat(web): per-mutation success/error toast metadata (#47)
Declare meta on all 18 mutation hooks: meta.successMessage (toast.* key)
on every discrete user action, meta.suppressErrorToast where the consuming
component already renders the error inline. Corrected useUpdateFieldDefinition
to suppress (FieldForm renders update.isError as form.rejected inline).
Add an RTL+MSW integration test wiring the real MutationCache via
makeQueryClient() + ToastRegion: success toast, catch-all error toast, and
suppressed-no-toast. Tidy the toast Close aria-label to t("common.close")
with en/sv parity.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import type * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Toast as ToastPrimitive } from "@base-ui/react/toast";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { toastManager } from "@/toast/toast-manager";
|
||||
|
||||
function ToastList() {
|
||||
const { t } = useTranslation();
|
||||
const { toasts } = ToastPrimitive.useToastManager();
|
||||
return toasts.map((toast) => (
|
||||
<ToastPrimitive.Root
|
||||
@@ -31,7 +33,7 @@ function ToastList() {
|
||||
</div>
|
||||
<ToastPrimitive.Close
|
||||
data-slot="toast-close"
|
||||
aria-label="Close"
|
||||
aria-label={t("common.close")}
|
||||
className="text-neutral-400 hover:text-neutral-700"
|
||||
>
|
||||
×
|
||||
|
||||
Reference in New Issue
Block a user