Skip to content

bug: attachment upload notifications are shown again in other channels after switching channel #3279

Description

@minhth1529

Describe the bug

An attachment upload notification raised in channel A (e.g. validation:attachment:upload:blocked when a file exceeds the upload size limit) is displayed again in channel B after the user switches channel, even though channel B has no upload at all.

The notification itself is only created once — I patched client.notifications.add and confirmed exactly one validation:attachment:upload:blocked entry. What happens is that the same still-alive notification is re-rendered by the newly mounted NotificationList:

client.notifications is a single global store (NotificationManager), not scoped per channel.
NotificationList is rendered by MessageList / VirtualizedMessageList, i.e. inside . Switching the active channel unmounts that list and mounts a new one, which renders whatever is still in the global store.
Panel targeting only distinguishes panel type: isNotificationForPanel() reads target: tags and otherwise falls back to "channel" (components/Notifications/notificationTarget.mjs). There is no scoping by channel instance.
The auto-dismiss timer only starts once a list renders the notification and it is at least 50% visible (IntersectionObserver in NotificationList), so within its 3s lifetime a channel switch shows it again in the new channel.
Integrators cannot filter it out either: the notifications emitted by AttachmentManager carry no channel identity. createBlockedAttachmentUploadNotificationMiddleware sets origin.context = { blockedAttachment } and createUploadErrorHandlerMiddleware sets origin.context = { attachment } — no channel_cid, no composer reference.

Point 5 is the part that makes this unworkable from user land, so I filed it here rather than working around it. The same applies to api:attachment:upload:failed.

To Reproduce

Open channel A and attach a file larger than the upload size limit (default 100 MB).
The toast "Attachment upload blocked due to size limit" appears — correct.
Within ~3 seconds, click channel B in the channel list.
The same toast appears again in channel B, which has no attachment and no upload in progress.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Package version

stream-chat-react: 14.12.0
stream-chat-css: 5.16.1
stream-chat-js: 9.52.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:confirmedDescribed issue has been reproduced by the repo maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions