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().
This commit is contained in:
1 file changed
+1
-1
@@ -405,7 +405,7 @@ function AnchoredToasts() {
|
||||
className="min-w-0 break-words font-medium"
|
||||
data-slot="toast-title"
|
||||
/>
|
||||
{toast.type === "error" && toast.description && (
|
||||
{toast.type === "error" && typeof toast.description === "string" && (
|
||||
<CopyErrorButton text={toast.description} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user