Toasts that plugins show with `sonner` never appear since 26.11.2 (no Toaster in plugin frames)
What happened?
Since 26.11.2, a plugin's frontend runs in sandboxed frames. When a plugin imports toast from sonner and calls it there, nothing appears and nothing is logged. Toasts from the SDK's useToast() still show.
I noticed it with SSH Terminal. After pasting an image, the "Image uploaded: toast.error("This browser cannot read images from the clipboard") there. The toast just isn't shown.
Steps to reproduce
- Open a terminal to any host.
- In the bar under the terminal, click Image, then Paste image. A frame has no
navigator.clipboard.read, so SSH Terminal shows an error toast right away. - No toast appears.
Or in DevTools, with the console's context set to the SSH Terminal frame:
(await import("sonner")).toast.error("from sonner") // nothing appears
(await import("@termix-ssh/plugin-sdk/frontend")).useToast().error("from useToast") // appears
What did you expect?
The toast appears, as it did before 26.11.2 and as useToast() toasts do.
Termix version
First noticed on 26.11.2 (Docker server and macOS desktop app). Reproduced on a build of b4a75bd2 (newer than 26.11.3) with its bundled SSH Terminal 1.5.0. 26.11.3 has the same frame code.
Platform
Web browser
Server install
Docker
Environment
Same in the web UI and in the macOS desktop app. The reproduction below used a web build in headless Chromium.
Logs
Nothing is logged. The toast does reach the frame's copy of sonner. In the SSH Terminal frame, toast.getHistory() returns:
error: This browser cannot read images from the clipboard
Anything else?
Why it happens
sonner is one of the modules the import map shares (SHARED_VENDORS in scripts/lib/plugin-import-map.mjs). In a frame it resolves to the frame runtime's own copy (/plugin-assets/_runtime/<hash>/shared/sonner.js), and nothing in the frame mounts a Toaster for that copy. So a toast is added to that copy's state and never drawn. Core mounts a Toaster in src/main.tsx, on the full-screen app's sign-in screen and in frame-host.tsx (the mobile app's web view), but not in a sandboxed frame. useToast() works because the frame bridge hands it to the shell (call("toast"), shown by frame-connection.ts).
The plugin guide points both ways. It lists sonner under "Shared from Termix and never bundled", and its Frames section says toasts "go through the shell".
Which plugins
15 bundled plugins import toast from sonner and run in frames (none of them has ui:layout, ui:theme or sync:provide): Alerts, Credential Tools, Docker, File Manager, Host Metrics, Import/Export, Remote Desktop, Snippets, SSH Terminal, SSO, Telemetry, TOTP, Tunnels, WebAuthn and Workspaces. Together that's about 500 toast calls. I only tested SSH Terminal, but the others use the same import. #1941 also mentions no progress or error toast for File Manager downloads, and File Manager shows download progress with toast.loading from sonner, so that part may be this too. Layouts, themes and Sync run in the page, so their toasts work.
How I checked
A web build of b4a75bd2 with its bundled plugins, driven by headless Chromium, which counted every [data-sonner-toast] added to the page and to every frame:
| Step | Toasts shown |
|---|---|
| Sign in | "Login successful" |
| Image > Paste image in SSH Terminal | none. The frame's sonner history has the error, and the frame has no [data-sonner-toaster] |
toast.error() from sonner in the same frame |
none |
useToast().error() in the same frame |
shown, bottom right |
Ways to fix it
I can see three, and I'd rather ask which one you want before writing any of them:
- Core passes a frame's
sonnertoasts to the shell. One change fixes every plugin. But the plugins use more than a message. File Manager has loading toasts it updates byidand dismisses, cancel and action buttons, and JSX content. Docker and Snippets use action buttons, and SSH Terminal setsdurationanddescription. Buttons and JSX can't cross the frame as they are, so this needs a rule for what gets through. - Each view frame draws its own toasts. Mount a
Toasterin view frames. Every option keeps working, but a toast shows inside the frame's area (fine for a tab, cramped in a small panel or slot), and toasts from the hidden background frame still don't show. - Plugins switch to
useToast(). No core change, but 15 plugins to update.ToastApitakes only a message, so loading toasts, buttons,durationanddescriptionare lost unless the SDK gets options.
I'm happy to open a PR for whichever you pick.
Before you submit
- [X] I searched open and closed issues and this is not a duplicate
- [X] I am on the latest version, or I said which version I am on
Auto-triage
Toasts generated by plugins using the shared sonner library do not appear in sandboxed frames because the core does not mount a Toaster component in those frames. This affects multiple bundled plugins including SSH Terminal and File Manager.
| Field | Value |
|---|---|
| Type | Bug |
| Difficulty | 3/5 (Moderate) |
| Priority | Medium |
A maintainer will take a look. If anything above looks wrong, just say so.
This was fixed in v26.12.0. Update Termix to the latest version to get it. Thanks for the report!