A failed generation put the server's error straight into a toast. The
transformers "Unrecognized model" error is ~4.8KB, of which the first
sentence carries the meaning and the remaining 4.7KB is an alphabetical
list of every architecture it knows. In a 420px toast with
overflow-hidden and no scroll, that clipped the text at both ends and
pushed the close button off-screen: unreadable and undismissable.
- ToastDescription is capped at 40vh and scrolls, wraps on whitespace
and breaks long unspaced tokens so a path cannot widen the toast.
- The toast aligns to the start rather than centring, so the title
stays visible next to a tall description.
- condenseError() keeps the head of an oversized error, cutting at the
first newline or the last sentence end inside a 400-char budget, and
reports how many characters it dropped. Short errors pass through
untouched.
- When it does truncate, the toast offers a Copy action for the full
text and points at Settings -> Logs.
Verified against the real 4795-char error: 4795 -> 400 chars keeping
both meaningful sentences.
The hook moves to .tsx to render ToastAction, matching useAutoUpdater.tsx
which is a .tsx hook for the same reason. createElement was tried first
but this repo's ToastActionElement type is the older shadcn definition
(ReactElement<typeof ToastAction>) which only accepts JSX-constructed
elements.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>