Some fixes for HTTP caching not being invalidated properly

This commit is contained in:
Jorge Manrubia
2025-10-30 10:50:28 +01:00
parent 108d7b2835
commit b0e5a5ccb5
8 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ class CardsController < ApplicationController
end
def show
fresh_when etag: [ @card, @card.collection.columns ]
fresh_when etag: [ @card, @card.collection.columns, @card.collection.name ]
end
def edit
@@ -3,6 +3,6 @@ class Collections::Columns::ClosedsController < ApplicationController
def show
set_page_and_extract_portion_from @collection.cards.closed.recently_closed_first
fresh_when etag: [ @collection, @page.records ]
cards_fresh_when @page.records
end
end
@@ -3,6 +3,6 @@ class Collections::Columns::NotNowsController < ApplicationController
def show
set_page_and_extract_portion_from @collection.cards.postponed.reverse_chronologically.with_golden_first
fresh_when etag: [ @collection, @page.records ]
cards_fresh_when @page.records
end
end
@@ -3,6 +3,6 @@ class Collections::Columns::StreamsController < ApplicationController
def show
set_page_and_extract_portion_from @collection.cards.awaiting_triage.by_last_activity.with_golden_first
fresh_when etag: [ @collection, @page.records ]
cards_fresh_when @page.records
end
end
@@ -5,7 +5,7 @@ class Collections::ColumnsController < ApplicationController
def show
set_page_and_extract_portion_from @column.cards.active.by_last_activity.with_golden_first
fresh_when etag: [ @column, @page.records ]
cards_fresh_when @page.records
end
def create
@@ -9,4 +9,8 @@ module CollectionScoped
def set_collection
@collection = Current.user.collections.find(params[:collection_id])
end
def cards_fresh_when(cards)
fresh_when etag: [ cards, @collection.entropy_configuration, @collection.name, Column.all ]
end
end
+4
View File
@@ -50,4 +50,8 @@ module CardsHelper
def card_preview_cache_parts(card)
[ card, card.collection.entropy_configuration, card.collection.publication, card.collection.name, card.column ]
end
def card_perma_cache_parts(card)
[ card, card.collection.columns, card.collection.name ]
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
<% cache [ card, card.collection.columns ] do %>
<% cache card_perma_cache_parts(card) do %>
<section id="<%= dom_id(card, :card_container) %>" class="card-perma" style="--card-color: <%= card.color %>;">
<%= render "cards/container/status", card: card %>