From 4764de3e0ec9cf8649d5684bb071b629bec07ded Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 14 Oct 2025 03:56:55 +0000 Subject: [PATCH] Coerce toast descriptions to strings (lib) cgen-a45f9e187907479d95483cb2d5598451 --- client/lib/aethex-toast.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/lib/aethex-toast.ts b/client/lib/aethex-toast.ts index 772b3722..f4ecbffe 100644 --- a/client/lib/aethex-toast.ts +++ b/client/lib/aethex-toast.ts @@ -8,9 +8,22 @@ interface AethexToastOptions { export const aethexToast = { success: (options: AethexToastOptions) => { + const normalize = (d?: any) => { + if (d == null) return undefined; + if (typeof d === "string") return d; + if (typeof d === "object") { + if ((d as any).message) return String((d as any).message); + try { + return JSON.stringify(d); + } catch (e) { + return String(d); + } + } + return String(d); + }; return toast({ title: `✅ ${options.title || "Success"}`, - description: options.description, + description: normalize(options.description), duration: options.duration || 5000, variant: "success" as any, });