From 0c052636e589d54e04694dbb1416fcfaa5326106 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 14 Oct 2025 03:56:50 +0000 Subject: [PATCH] Coerce toast descriptions to strings cgen-587045e288c14456b3f3ab9b85a13143 --- client/hooks/use-aethex-toast.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/client/hooks/use-aethex-toast.ts b/client/hooks/use-aethex-toast.ts index 663fe38d..aeb3433b 100644 --- a/client/hooks/use-aethex-toast.ts +++ b/client/hooks/use-aethex-toast.ts @@ -7,10 +7,24 @@ interface AethexToastOptions { } export const useAethexToast = () => { + 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); + }; + const success = (options: AethexToastOptions) => { return baseToast({ title: `✅ ${options.title || "Success"}`, - description: options.description, + description: normalize(options.description), duration: options.duration || 5000, variant: "success" as any, });