Conversation
…ession of #4365) #4365 added caching to getUnreadNotificationCount() and getNewNotificationCount() and correctly invalidated the cache in ReadAllNotificationsHandler and ReadNotificationHandler. DeleteAllNotificationsHandler was missed, so deleting all notifications left the stale count in the cache for up to 5 minutes — causing the notification badge to reappear after deletion until the cache naturally expired. Fix: call resolve('cache.store')->forget() on both count keys after deletion, matching the pattern already used in ReadAllNotificationsHandler. Also adds a regression test that primes the cache with a stale count, calls DELETE /notifications, and asserts both cache keys are cleared. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9c534ff to
1dee5f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regression of #4365
Port of #4390 (2.x fix) to 1.x.
#4365 added caching to
getUnreadNotificationCount()andgetNewNotificationCount()with active cache invalidation inReadAllNotificationsHandlerandReadNotificationHandler.DeleteAllNotificationsHandlerwas missed.Symptom
After clicking "Delete All" in the notifications dropdown, the notifications disappear from the list (optimistic update works) but the unread count badge reappears on the next page load and stays wrong for up to 5 minutes until the cache naturally expires.
Fix
Add
resolve('cache.store')->forget()calls for both count keys after deletion, matching the pattern already used inReadAllNotificationsHandler.Test
Added a regression test that primes both cache keys with a stale value of
99, callsDELETE /api/notifications, and asserts both keys arenullafter the request.Related
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com