Fix: problem with notifications not dismissing due to HTTP caching

The problem was related to tying the invalidation to the association of unread notifications. Its
cache key can remain constant as you read old notifications.

https://app.box-car.com/5986089/cards/2620/edit
This commit is contained in:
Jorge Manrubia
2025-10-31 11:34:42 +01:00
parent 2a083bd82f
commit 958deab2c7
@@ -2,6 +2,8 @@ class Notifications::TraysController < ApplicationController
def show
@notifications = Current.user.notifications.unread.ordered.limit(100)
fresh_when @notifications
# Invalidate on the whole set instead of the unread set since the max updated at in the unread set
# can stay the same when reading old notifications.
fresh_when Current.user.notifications
end
end