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.

Fixed N+1s in Store API Products endpoint after adding Channels (#14149)

Damian Legawieccda55f3c9632
diff --git a/spree/api/app/controllers/spree/api/v3/store/products_controller.rb b/spree/api/app/controllers/spree/api/v3/store/products_controller.rb
index 32a0bedf26..3f78799580 100644
--- a/spree/api/app/controllers/spree/api/v3/store/products_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/products_controller.rb
@@ -35,6 +35,7 @@ module Spree
# these scopes are not automatically picked by ar_lazy_preload gem and we need to explicitly include them
def scope_includes
[
+ product_publications: [],
primary_media: [attachment_attachment: :blob],
master: [:prices, stock_items: [:stock_location, :active_stock_reservations]],
variants: [:prices, stock_items: [:stock_location, :active_stock_reservations]]