Skip to content

Bug: Notifications — "Mark all as read" button stays enabled while personal-stream mutation is in-flight #2019

Closed

Description

@yannickmonney

Area

Notifications panel — "Mark all as read" button disabled state logic

Steps to reproduce

  1. Open the notifications bell / panel with at least one unread personal notification (review request, task assignment, etc.).
  2. Click Mark all as read rapidly twice in quick succession.

Expected

The button is disabled for the entire duration of both mutations it fires — org stream (markAllRead) and personal stream (markAllNotificationsRead) — preventing double submission.

Actual

The button's disabled prop is only bound to markAllRead.isPending (the org-notification mutation). The personal-stream mutation (markAllMyRead) runs concurrently and has no guard. If the org mutation resolves first, the button becomes re-enabled while markAllMyRead is still in-flight, allowing a second markAllNotificationsRead call to be submitted.

Evidence

services/platform/app/features/notifications/components/notification-list-panel.tsx:201

<Button
  variant="ghost"
  disabled={markAllRead.isPending}   // ← only guards the org stream
  onClick={handleMarkAllRead}
>

handleMarkAllRead (line 130–131) fires both mutations:

void markAllRead.mutateAsync({ organizationId });      // org stream
void markAllMyRead.mutateAsync({ organizationId });    // personal stream — NOT guarded

The fix is:

disabled={markAllRead.isPending || markAllMyRead.isPending}

Notes

  • Both useMarkAllNotificationsRead and useMarkAllMyNotificationsRead come from separate useConvexMutation instances, so their isPending states are independent.
  • The personal markAllNotificationsRead mutation (convex/collab/notifications.ts:120) is idempotent (it only patches read: false rows), so the duplicate call produces no data corruption — the concern is unnecessary network traffic and the Convex write quota cost of a redundant mutation execution.
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

    automatedbugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions