Skip to content

fix(notifications): stop refetching all notifications on mark-as-read#2605

Merged
gbirman merged 1 commit into
mainfrom
macro-cz4SwsEjA2KgYH1LVzsaF-opening-channel-from-sidebar-dispatches-user-notification-requests
Apr 15, 2026
Merged

fix(notifications): stop refetching all notifications on mark-as-read#2605
gbirman merged 1 commit into
mainfrom
macro-cz4SwsEjA2KgYH1LVzsaF-opening-channel-from-sidebar-dispatches-user-notification-requests

Conversation

@gbirman
Copy link
Copy Markdown
Contributor

@gbirman gbirman commented Apr 15, 2026

Summary

  • notificationsMutationSuccessCallback was calling invalidateQueries without refetchType, which defaults to 'active' — triggering an immediate GET /user_notifications?limit=500 every time a notification mutation succeeds
  • Opening a channel from the sidebar mounts MarkMessageNotifications, which calls markAsRead → triggers the seen mutation → success callback refetches all 500 notifications
  • Added refetchType: 'none' so the invalidation marks cached data as stale without an immediate refetch — the optimistic update in onMutate already applies the correct cache state

🤖 Generated with Claude Code

notificationsMutationSuccessCallback was calling invalidateQueries
without refetchType, causing an immediate GET /user_notifications?limit=500
every time a notification was marked as read (e.g. opening a channel
from the sidebar). The optimistic update in onMutate already applies
the correct cache state, so the refetch is unnecessary. Adding
refetchType: 'none' marks the data as stale without triggering a
network request.
@macro-application
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@gbirman has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 33 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 20 minutes and 33 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d6594352-4d0c-4988-9f48-3132e1300e71

📥 Commits

Reviewing files that changed from the base of the PR and between 720b804 and dc455bc.

📒 Files selected for processing (1)
  • js/app/packages/queries/notification/user-notifications.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

@gbirman gbirman merged commit cc878c3 into main Apr 15, 2026
24 checks passed
@gbirman gbirman deleted the macro-cz4SwsEjA2KgYH1LVzsaF-opening-channel-from-sidebar-dispatches-user-notification-requests branch April 15, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant