From 958deab2c7e776a205952ef112d7ed5f97cb2c83 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 31 Oct 2025 11:34:42 +0100 Subject: [PATCH] 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 --- app/controllers/notifications/trays_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/notifications/trays_controller.rb b/app/controllers/notifications/trays_controller.rb index 4a7e9ca62..26a1f06e5 100644 --- a/app/controllers/notifications/trays_controller.rb +++ b/app/controllers/notifications/trays_controller.rb @@ -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