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 return authorization's partial cache in the order view (#12864)

Damian Kaczmarczyk9ec9561fcfc0
diff --git a/admin/app/controllers/spree/admin/orders_controller.rb b/admin/app/controllers/spree/admin/orders_controller.rb
index dec4cabf39..7a5b925deb 100644
--- a/admin/app/controllers/spree/admin/orders_controller.rb
+++ b/admin/app/controllers/spree/admin/orders_controller.rb
@@ -79,7 +79,7 @@ module Spree
@payments = @order.payments.includes(:payment_method, :source).order(:created_at)
@refunds = @order.refunds
- @return_authorizations = @order.return_authorizations
+ @return_authorizations = @order.return_authorizations.includes(:return_items)
@customer_returns = @order.customer_returns.distinct
end
diff --git a/admin/app/views/spree/admin/orders/_return_authorizations.html.erb b/admin/app/views/spree/admin/orders/_return_authorizations.html.erb
index 2df9f7ec6b..565da0a9d4 100644
--- a/admin/app/views/spree/admin/orders/_return_authorizations.html.erb
+++ b/admin/app/views/spree/admin/orders/_return_authorizations.html.erb
@@ -17,7 +17,9 @@
</tr>
</thead>
<tbody>
- <%= render partial: 'spree/admin/orders/return_authorizations/return_authorization', collection: @return_authorizations, cached: spree_base_cache_scope %>
+ <%= render partial: "spree/admin/orders/return_authorizations/return_authorization",
+ collection: @return_authorizations,
+ cached: ->(r) { [spree_base_cache_key, r.cache_key_with_version, r.return_items.maximum(:updated_at)] } %>
</tbody>
</table>
</div>