mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2799] [Issue]: Mobile: chat notification bubbles never auto-dismiss — they stack and each must be closed manually #1423
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1423
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2799
Summary
On mobile, the floating chat notification bubbles (the avatar circles that appear on the right edge of the chat view when a character messages you in another conversation) never go away on their own. They are only removed when the user manually taps the per-bubble X, opens that chat, or the chat is deleted. As more conversations generate messages, the bubbles stack up and each one has to be dismissed by hand.
The bubbles are rendered by
packages/client/src/components/chat/ChatNotificationBubbles.tsxand backed by thechatNotificationsmap inpackages/client/src/stores/chat.store.ts. The store'saddNotificationaction has no auto-dismiss timer anywhere — removal is exclusively manual or on-chat-open. That is the literal match for the report wording ("notification bubbles never auto-dismiss; they stack and each must be closed manually").Symptom & UX impact (mobile)
ChatNotificationBubbles.tsx:163-177).Steps to reproduce
On a mobile/touch device (or a narrow viewport, ≤
md):addNotification.Root cause (exact file:line trace)
True source — avatar notification bubbles, no auto-dismiss timer:
useChatStore.addNotification(...), called from:packages/client/src/hooks/use-background-autonomous.ts:238packages/client/src/hooks/use-generate.ts:1621packages/client/src/hooks/use-generate.ts:2251packages/client/src/stores/chat.store.ts:605-620inserts/increments the entry in thechatNotificationsMap. There is nosetTimeout/auto-expiry anywhere in this action or the store.dismissNotification(chatId)— the manual X (chat.store.ts:621-628),setActiveChatIdguard (addNotificationearly-returns when the chat is active,chat.store.ts:608),chat.store.ts:589-593).packages/client/src/components/chat/ChatNotificationBubbles.tsxrenders oneNotificationBubbleper entry (desktop: lines 49-60; mobile collapsed/expanded: lines 62-132) and only ever callsdismissNotificationfrom the per-bubble X (onDismiss, lines 56 / 75-78 / 163-177). It is mounted inpackages/client/src/components/layout/AppShell.tsx:863. No timer here either.Because nothing schedules removal, the bubbles live until the user acts — exactly the reported behavior.
Important nuance for the fix:
dismissNotificationnot only removes the bubble, it adds the chat id to a persistentdismissedNotificationsset (chat.store.ts:625-626), which permanently suppresses future notifications for that chat (addNotificationearly-returns on it,chat.store.ts:609). An auto-dismiss must therefore not calldismissNotification— it must remove only fromchatNotificationsso later messages can re-notify.Why the earlier sonner-toast theory is wrong (so the PR author doesn't chase it):
sonner@2.0.7auto-close timer (node_modules/.pnpm/sonner@2.0.7…/dist/index.mjs:589-612) runsstartTimer()for every toast and only pauses whenexpanded || interacting || isDocumentHidden(line 605).expandedis set true only byonMouseEnter/onMouseMove(lines 1128-1129) — neither fires on touch.interactingis set on pointer-down and cleared on pointer-up (lines 1140-1142), so a tap doesn't pin anything.expandedstays false → the timer runs → toasts auto-dismiss after their duration. Toasts beyondvisibleToastsare still mounted and still run their own timers (visibleToastscontrols rendering count, not lifetime).expand/expandByDefaultto<Toaster>would forcedata-expanded=true(dist/index.mjs:666,1052) and hit the pause branch — counterproductive, it would stop toasts from auto-closing. Do not do this.Suggested fix (concrete)
Primary — add an auto-dismiss timer for the avatar bubbles, centrally in the store. Schedule a timeout in
addNotificationthat removes the entry fromchatNotificationsonly (never touchingdismissedNotifications), reset on re-notify, and skip while that chat is active.In
packages/client/src/stores/chat.store.ts:Then in
addNotification(chat.store.ts:605-620), after computing the new map, (re)arm the timer:Also clear the timer in
dismissNotificationand wherever entries are removed (the reconciliation block atchat.store.ts:589-593and onsetActiveChatId) to avoid stray timers firing against deleted chats. AddautoDismissNotificationto the store interface nearchat.store.ts:188-194.Alternative (component-local). Instead of the store, add a
useEffectper bubble insideChatNotificationBubbles.tsxthat calls an auto-remove after N ms and clears on unmount. This is simpler to read but spreads timer logic across mounts and is harder to coordinate with the mobile collapsed/expanded state; the store approach is preferred because it is central and keeps the suppression-set distinction correct.Consideration: when bubbles are mobile-expanded by the user (
mobileExpanded,ChatNotificationBubbles.tsx:27/65), consider pausing auto-dismiss so a bubble doesn't vanish mid-interaction. Simplest acceptable behavior: let the timer run regardless; if it proves jarring in testing, gate the timer on!activeInteraction.Secondary (optional, toast polish — not required for this report): transient generation-error toasts in
packages/client/src/hooks/use-generate.ts:39-42have no stableid, so repeated identical errors (e.g. "No API connection configured for this chat", returned atpackages/server/src/routes/generate.routes.ts:1351) stack as separate toasts. Giving them a stable id de-dupes them (matching the existing CSRF-cooldown pattern inpackages/client/src/lib/csrf-fetch.ts:9-42):Optionally lower the 15000ms duration (e.g. 6000ms) since these are transient send errors. Do NOT add
expand/expandByDefaultto<Toaster>(App.tsx:537) — per the trace above it would pause auto-close on mobile.visibleToastsis harmless but does not fix anything.Affected files
packages/client/src/stores/chat.store.ts— primary fix (auto-dismiss timer +autoDismissNotificationaction + timer cleanup).packages/client/src/components/chat/ChatNotificationBubbles.tsx— the bubbles UI; alternative fix location; verify expanded-state interaction.packages/client/src/components/layout/AppShell.tsx— mount point (:863), context only.packages/client/src/hooks/use-background-autonomous.ts,packages/client/src/hooks/use-generate.ts— callers ofaddNotification(:238,:1621,:2251); context for the timer behavior.packages/client/src/hooks/use-generate.ts(showError,:39-42),packages/client/src/App.tsx(<Toaster>,:537) — toast dedupe polish;packages/client/src/lib/csrf-fetch.ts(:9-42) precedent.Validation
pnpm installthenpnpm check(TypeScript + ESLint) passes.dismissedNotifications).chat.store.ts:589-593) clears any pending timer for it (no timer fires against a removed chat).setTimeoutcallbacks mutating state.mdbreakpoint check: desktop layout (all bubbles shown, lines 49-60) also auto-dismisses correctly.AI-investigated against released 2.0.0; verify before fixing.
@SpicyMarinara commented on GitHub (Jun 22, 2026):
Addressed in PR #2790 / commit acab1fba: chat notification bubbles now auto-dismiss after a short timeout, timers are cleaned up when chats open/reset, and mobile expanded stacks can be dismissed together.