Skip to content

Commit 30497a8

Browse files
committed
fix: add typeof string type guard for toast description in anchored toast
The floating toast correctly guarded with typeof toast.description === 'string' before passing to CopyErrorButton, but the anchored toast only checked truthiness. This could pass non-string values (e.g. React nodes) to clipboard.writeText().
1 parent 5568558 commit 30497a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/web/src/components/ui/toast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ function AnchoredToasts() {
405405
className="min-w-0 break-words font-medium"
406406
data-slot="toast-title"
407407
/>
408-
{toast.type === "error" && toast.description && (
408+
{toast.type === "error" && typeof toast.description === "string" && (
409409
<CopyErrorButton text={toast.description} />
410410
)}
411411
</div>

0 commit comments

Comments
 (0)