Skip to content

Commit d29c66d

Browse files
committed
add set
1 parent efc6cc0 commit d29c66d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/view_component/cacheable.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# frozen_string_literal: true
22

3+
require 'set'
4+
35
module ViewComponent::Cacheable
46
extend ActiveSupport::Concern
57

68
included do
7-
class_attribute :__vc_cache_dependencies, default: [:format, :__vc_format, :identifier]
9+
class_attribute :__vc_cache_dependencies, default: Set[:format, :__vc_format, :identifier]
810

911
# For caching, such as #cache_if
1012
#
@@ -33,7 +35,7 @@ def __vc_render_cacheable(rendered_template)
3335
class_methods do
3436
# For caching the component
3537
def cache_on(*args)
36-
__vc_cache_dependencies.push(*args)
38+
__vc_cache_dependencies.merge(args)
3739
end
3840

3941
def inherited(child)

0 commit comments

Comments
 (0)