diff --git a/app/components/shared/comments_component.html.erb b/app/components/shared/comments_component.html.erb index 9dd3ab9c3..b6b12f691 100644 --- a/app/components/shared/comments_component.html.erb +++ b/app/components/shared/comments_component.html.erb @@ -1,4 +1,4 @@ -<% cache [locale_and_user_status, current_order, commentable_cache_key(record), comment_tree.comments, comment_tree.comment_authors, record.comments_count] do %> +<% cache cache_key do %>
<%= content %> diff --git a/app/components/shared/comments_component.rb b/app/components/shared/comments_component.rb index 01a1eff86..b517426c9 100644 --- a/app/components/shared/comments_component.rb +++ b/app/components/shared/comments_component.rb @@ -6,4 +6,17 @@ class Shared::CommentsComponent < ApplicationComponent @record = record @comment_tree = comment_tree end + + private + + def cache_key + [ + locale_and_user_status, + current_order, + commentable_cache_key(record), + comment_tree.comments, + comment_tree.comment_authors, + record.comments_count + ] + end end