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.

Storefront: improve speed of `shop all` page

Damian Legawiec8331c4cc7c72
diff --git a/storefront/app/controllers/spree/products_controller.rb b/storefront/app/controllers/spree/products_controller.rb
index 46ae479056..ed05e6a00c 100644
--- a/storefront/app/controllers/spree/products_controller.rb
+++ b/storefront/app/controllers/spree/products_controller.rb
@@ -84,12 +84,15 @@ module Spree
end
def track_show
+ return if turbo_frame_request? || turbo_stream_request?
return if params[:options].present? # we don't want to track product views for variants
track_event('product_viewed', { product: @product })
end
def track_index
+ return if turbo_frame_request? || turbo_stream_request?
+
track_event('product_list_viewed', { taxon: @taxon })
end
end
diff --git a/storefront/app/views/themes/default/spree/page_sections/_product_grid.html.erb b/storefront/app/views/themes/default/spree/page_sections/_product_grid.html.erb
index 9e78a90e38..c2c1e81cf9 100644
--- a/storefront/app/views/themes/default/spree/page_sections/_product_grid.html.erb
+++ b/storefront/app/views/themes/default/spree/page_sections/_product_grid.html.erb
@@ -47,6 +47,6 @@
<%= render 'spree/products/show_more_button' %>
</div>
- <%= render 'spree/products/json_ld_list', products: products %>
+ <%= render 'spree/products/json_ld_list', products: products unless turbo_frame_request? %>
<% end %>
<% end %>