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.

Optimize performance of loading translations

Rafal Cymerysa30c96e61002
diff --git a/api/app/controllers/concerns/spree/api/v2/product_list_includes.rb b/api/app/controllers/concerns/spree/api/v2/product_list_includes.rb
index f6c7aa2faa..885f9148a3 100644
--- a/api/app/controllers/concerns/spree/api/v2/product_list_includes.rb
+++ b/api/app/controllers/concerns/spree/api/v2/product_list_includes.rb
@@ -8,7 +8,8 @@ module Spree
option_types: [],
variant_images: [],
master: product_variant_includes,
- variants: product_variant_includes
+ variants: product_variant_includes,
+ translations: []
}
end
diff --git a/api/app/controllers/spree/api/v2/storefront/taxons_controller.rb b/api/app/controllers/spree/api/v2/storefront/taxons_controller.rb
index 0e78a0b9ff..81e4d369a2 100644
--- a/api/app/controllers/spree/api/v2/storefront/taxons_controller.rb
+++ b/api/app/controllers/spree/api/v2/storefront/taxons_controller.rb
@@ -30,13 +30,14 @@ module Spree
end
def scope_includes
- node_includes = %i[icon parent taxonomy]
+ node_includes = %i[icon parent taxonomy translations]
{
parent: node_includes,
children: node_includes,
taxonomy: [root: node_includes],
- icon: [attachment_attachment: :blob]
+ icon: [attachment_attachment: :blob],
+ translations: []
}
end
diff --git a/core/app/finders/spree/option_values/find_available.rb b/core/app/finders/spree/option_values/find_available.rb
index 034119bd22..94aca09f85 100644
--- a/core/app/finders/spree/option_values/find_available.rb
+++ b/core/app/finders/spree/option_values/find_available.rb
@@ -9,7 +9,7 @@ module Spree
end
def execute
- find_available(scope, products_scope).select(select_args).order(order_args)
+ find_available(scope, products_scope).includes(:translations).select(select_args).order(order_args)
end
private
diff --git a/core/app/finders/spree/product_properties/find_available.rb b/core/app/finders/spree/product_properties/find_available.rb
index 79e497dcb4..420905d207 100644
--- a/core/app/finders/spree/product_properties/find_available.rb
+++ b/core/app/finders/spree/product_properties/find_available.rb
@@ -9,7 +9,7 @@ module Spree
end
def execute
- find_available(scope, products_scope)
+ find_available(scope, products_scope).includes(:translations)
end
private