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.

Lazy load hidden turbo frames (eg. cart pane) (#13026)

Damian Legawiec1756ae358e67
diff --git a/storefront/app/views/themes/default/spree/page_sections/_header.html.erb b/storefront/app/views/themes/default/spree/page_sections/_header.html.erb
index b2d0c7da5d..35eb9c43c3 100644
--- a/storefront/app/views/themes/default/spree/page_sections/_header.html.erb
+++ b/storefront/app/views/themes/default/spree/page_sections/_header.html.erb
@@ -96,7 +96,7 @@
</span>
<% end %>
<% end %>
- <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :eager %>
+ <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :lazy %>
</div>
<% end %>
<!-- Desktop Account -->
diff --git a/storefront/app/views/themes/default/spree/page_sections/nav/_mobile.html.erb b/storefront/app/views/themes/default/spree/page_sections/nav/_mobile.html.erb
index fc65c6def1..8a85dbb905 100644
--- a/storefront/app/views/themes/default/spree/page_sections/nav/_mobile.html.erb
+++ b/storefront/app/views/themes/default/spree/page_sections/nav/_mobile.html.erb
@@ -123,7 +123,7 @@
</span>
<% end %>
<% end %>
- <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :eager %>
+ <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :lazy %>
</div>
</div>
<% end %>
diff --git a/storefront/app/views/themes/default/spree/shared/_cart_pane.html.erb b/storefront/app/views/themes/default/spree/shared/_cart_pane.html.erb
index 8f0d80af36..a440e27944 100644
--- a/storefront/app/views/themes/default/spree/shared/_cart_pane.html.erb
+++ b/storefront/app/views/themes/default/spree/shared/_cart_pane.html.erb
@@ -34,7 +34,7 @@
</span>
</div>
<div class='flex-1 h-0 overflow-y-auto'>
- <%= turbo_frame_tag cart_id(order), class: 'cart-contents', src: spree.cart_path, data: { turbo_permanent: true } %>
+ <%= turbo_frame_tag cart_id(order), class: 'cart-contents', src: spree.cart_path, data: { turbo_permanent: true }, loading: :lazy %>
</div>
</div>
</div>