Repository navigation
Add a notification center and stop clipping long toasts - #2882
Merged
Merged
Conversation
andrewkchan
force-pushed
the
notification-center
branch
4 times, most recently
from
September 2, 2026 01:13
e4483a8 to
05f9199
Compare
Toasts auto-dismiss after four seconds and nothing recorded them, so a message you missed was gone for good. Toast titles and descriptions are also truncated to a single line, so a long one — a plugin install failure carrying an esbuild error, say — could not be read at all without copy-pasting it somewhere else. Add an in-memory store that records every toast for the life of the session. Reusing a toast id updates the entry in place, so a loading toast replaced by its result stays one row; transient loading toasts are not recorded. Measure whether a toast description actually overflows its single line and, when it does, offer a "Show more" action beside the toast's other actions. It opens the notification center scrolled to that entry. Add NotificationCenter, anchored bottom-right on top of shared-ui's Popover, which already falls back to ResponsiveDrawerShell on compact viewports. It shows untruncated text with per-row copy and dismiss, and two header actions that name themselves on hover: "Clear all" and "Hide notifications". Opening it dismisses the toast stack so the two do not overlap. The only entry point is "Show all notifications" in the quick palette. The `notifications.open` command ships unbound so Settings → Keyboard can assign a chord, and it toggles, so it hides the tray too. PopoverContent auto-focuses its first tabbable child, which would be the destructive "Clear all" action; that both focuses the wrong thing and opened its tooltip on mount, whose Escape handler then swallowed the Escape that should have closed the tray. Prevent the open auto-focus. onOpenAutoFocus is already stripped on the compact drawer path by stripRadixContentProps, so this is desktop-only. Plugin toasts bypass appToast because plugins get the raw sonner namespace from installPluginRuntime, so wrap its `toast` export to record them too. PluginThreadList was the only place in the app calling sonner directly; move it to appToast. Verified: four tests covering the mechanisms that can actually break — the toast-id collapse, the plugin sonner wrapper preserving its un-wrapped methods, and the overflow measurement driving Show more. Typecheck clean for @bb/app, @bb/shared-ui, @bb/domain and @bb/server. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
andrewkchan
force-pushed
the
notification-center
branch
from
September 2, 2026 01:14
05f9199 to
c02a262
Compare
ymichael
added a commit
that referenced
this pull request
Sep 4, 2026
## Human comments ## What was wrong The global React Query mutation handler already owned generic error toasts when [PR #1582](#1582) added marketplace and plugin mutations with their own specific `onError` toasts but no global-handler opt-out. One failed action therefore had two toast owners; [PR #2882](#2882) made both alerts durable in notification history and separately missed a raw Sonner toast in the sidebar plugin-crash fallback. ## What changed All 12 current first-party mutations with bespoke local error toasts now opt out of the global mutation error toast, establishing one error-toast owner per mutation without content-deduplicating distinct events. `SidebarNavigationRegion` now routes its plugin-crash alert through the recorded `appToast` helper. Focused regression coverage verifies that a failed plugin update and a failed marketplace action each retain one alert, and that the sidebar crash alert is retained. There are no wire, CLI, guide, or documentation contract changes. ## How you verified The new plugin-update assertion failed before the fix with two retained notifications and passed after the fix with one contextual notification. The rebased focused suite passed 16/16 tests with `pnpm exec turbo run test --filter=@bb/app --force -- --run src/components/plugin/management/UpdatePluginDialog.test.tsx src/components/settings/MarketplacesSettingsSection.test.tsx src/components/sidebar/SidebarNavigationRegion.test.tsx`. `pnpm exec turbo run typecheck --filter=@bb/app --force` also passed. Earlier DevBrowser verification reproduced the marketplace flow changing from two visible/two retained alerts to one visible/one retained alert, and the sidebar crash from zero retained alerts to one. Fixes: no issue — post-merge follow-up > AGENT GENERATED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
This adds a notification center where you can see the full contents of all the notifications you got in 1 place. Currently it's needed cuz the notifications are actually clamped so you can't even see the full contents of a single notification without copy-pasting.
Screen.Recording.2026-09-01.at.6.02.23.PM.mov
Notification center can be accessed via command palette or just pressing "show more" on one of the longer notifications.
What was wrong
Long toast text was unreadable and unrecoverable, for two independent reasons. First, sonner 1.7.4 forces a collapsed non-front toast to the front toast's height —
[data-expanded="false"][data-front="false"] { height: var(--front-toast-height) }— andapps/app/src/app.css:594addsoverflow: hiddenon that same node so our custom card is clipped rather than overflowing. The moment a second, shorter toast arrived, a long one was cut off; hovering setsdata-expanded="true"and restores it, which is why the text was present but unreachable. Second, nothing recorded toasts, so a message that auto-dismissed after its four-second duration was gone for good. Together these made a long plugin install failure impossible to read — the reported symptom was aCould not resolve "@radix-ui/react-tabs"esbuild error that could only be recovered by copy-pasting it elsewhere.What changed
apps/app/src/lib/notifications/notification-store.ts(new): in-memory store recording every toast for the session, capped at 200. Reusing a toastidupdates the entry in place, so a loading toast replaced by its result stays one row; transientloadingtoasts are not recorded.apps/app/src/components/ui/app-toast.tsx: descriptions clamp to four lines and measure real overflow (scrollHeight > clientHeight). When clipped, the toast grows a Show more action that dismisses it and opens the center scrolled to that entry. Clamping also keeps toasts short, so the stacking bug cannot reproduce.apps/app/src/components/notifications/NotificationCenter.tsx(new): bottom-right tray built on shared-ui'sPopover, which already falls back toResponsiveDrawerShellon compact viewports per the AGENTS.md drawer rule. Untruncated text, per-row copy and dismiss, "Clear all". Opening it dismisses the toast stack so the two do not overlap.apps/app/src/components/sidebar/SidebarNotificationsButton.tsx(new) plusAppSidebar: sidebar bell badging the count raised since the center was last opened.packages/domain/src/app-keybindings.ts,apps/server/src/services/system/app-keybindings.ts,apps/app/src/lib/app-command-metadata.ts: newnotifications.opencommand, surfaced in the quick palette as "Show all notifications". It ships unbound rather than claiming a chord; Settings → Keyboard can assign one.apps/app/src/lib/notifications/plugin-toast-recording.ts(new) andplugin-frontend.ts: plugins receive the rawsonnernamespace frominstallPluginRuntime, bypassingappToast, so itstoastexport is wrapped to record plugin toasts too.apps/app/src/components/sidebar/PluginThreadList.tsx: the only place in the app callingsonnerdirectly; moved toappToast.packages/shared-ui: newBellicon (Notification03Icon).docs/configuration.md: new Notifications section.apps/app/src/components/ui/sonner.stories.tsx: long-build-error case so the clamp is reviewable in the Ladle catalog.No wire changes: this is app-layer state plus one
AppCommandIdenum addition, and nothing crosses the server/daemon boundary, soHOST_DAEMON_PROTOCOL_VERSIONis untouched.How you verified
26 new tests across the store, the plugin-toast wrapper, the toast clamp, and the tray. The clamp and Show-more tests fail before this change because neither the clamp class nor the action exists.
pnpm exec turbo run test --filter=@bb/app— 448 files, 3532 passed, 3 skippedpnpm exec turbo run test --filter=@bb/server— 2072 passedpnpm exec turbo run test --filter=@bb/domain --filter=@bb/shared-ui— passingpnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/domain --filter=@bb/server --filter=@bb/shared-ui— cleanNot yet verified visually: the clamp's visual balance and the popover's placement against the toast stack have not been eyeballed in a running app or in iOS Simulator Safari. Worth a look before merge.