Skip to content

Add an optimistic update for the mark-notification-as-read action so the unread indicator clears immediately #42

Description

@Chucks1093

Summary

Clicking a notification to mark it as read currently waits for the server response before the unread indicator clears, making the action feel slow. An optimistic update should clear the indicator immediately and roll back if the request fails.

Scope

  • Implement optimistic update in useMarkNotificationRead using React Query's onMutate / onError / onSettled
  • Cancel in-flight notification list queries before applying the optimistic update
  • Roll back to unread state if the mutation fails
  • Decrement the nav bell unread count optimistically and restore it on rollback
  • Invalidate the notification list cache when the mutation settles

Acceptance Criteria

  • Unread indicator clears immediately on click before server response
  • Failed mutation restores the unread indicator
  • Nav bell unread count decrements optimistically
  • Unread count restored on rollback
  • Notification cache invalidated after mutation settles

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions