Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Fix: Keyed the storefront filters cache on catalog versions

Damian Legawiecbbff3de18aa5
diff --git a/spree/api/app/controllers/spree/api/v3/store/products/filters_controller.rb b/spree/api/app/controllers/spree/api/v3/store/products/filters_controller.rb
index 9501436e48..f6940740df 100644
--- a/spree/api/app/controllers/spree/api/v3/store/products/filters_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/products/filters_controller.rb
@@ -63,7 +63,9 @@ module Spree
catalogs = Spree::Catalog.for_buyer(store: current_store, customer: current_user, channel: current_channel)
return if catalogs.empty?
- "catalogs-#{catalogs.map(&:id).sort.join('-')}"
+ # Versioned, since adding or removing a product touches the
+ # catalog without touching the product count or timestamps.
+ catalogs.map(&:cache_key_with_version).sort.join('/')
end
def filters_scope