Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
fix caching of Option Values filters
Łukasz Adamczyk0020e87e622a
diff --git a/core/app/models/spree/option_value_variant.rb b/core/app/models/spree/option_value_variant.rbindex 2262be06f9..f74fce82ff 100644--- a/core/app/models/spree/option_value_variant.rb+++ b/core/app/models/spree/option_value_variant.rb@@ -1,7 +1,7 @@module Spreeclass OptionValueVariant < Spree::Basebelongs_to :option_value, class_name: 'Spree::OptionValue'- belongs_to :variant, class_name: 'Spree::Variant'+ belongs_to :variant, touch: true, class_name: 'Spree::Variant'validates :option_value, :variant, presence: truevalidates :option_value_id, uniqueness: { scope: :variant_id }diff --git a/core/app/models/spree/variant.rb b/core/app/models/spree/variant.rbindex dcb1feb748..a92c7631d6 100644--- a/core/app/models/spree/variant.rb+++ b/core/app/models/spree/variant.rb@@ -29,7 +29,7 @@ module Spreeendhas_many :option_value_variants, class_name: 'Spree::OptionValueVariant'- has_many :option_values, through: :option_value_variants, class_name: 'Spree::OptionValue'+ has_many :option_values, through: :option_value_variants, dependent: :destroy, class_name: 'Spree::OptionValue'has_many :images, -> { order(:position) }, as: :viewable, dependent: :destroy, class_name: 'Spree::Image'diff --git a/frontend/app/views/spree/shared/_option_values.html.erb b/frontend/app/views/spree/shared/_option_values.html.erbindex e628b14960..1dbb532a2b 100644--- a/frontend/app/views/spree/shared/_option_values.html.erb+++ b/frontend/app/views/spree/shared/_option_values.html.erb@@ -1,5 +1,3 @@-<% cache base_cache_key + [ot_downcase_name, params_ot_downcase_name, filtering_params_cache_key, @taxon&.id] do %>- <% option_type.option_values.each do |option_value| %>- <%= option_value_filter_link(option_value, permitted_params) %>- <% end %>+<% option_type.option_values.each do |option_value| %>+ <%= option_value_filter_link(option_value, permitted_params) %><% end %>