Memoize OpenFoodNetwork::ScopeProductToHub

This means we avoid fetching all of the hub's variants every time we scope a product. Applies to every product loaded when displaying a shops's product list.
This commit is contained in:
Matt-Yorkley
2020-04-06 19:41:05 +02:00
parent ce45e7cf71
commit 2cb4c6bec2

View File

@@ -40,7 +40,7 @@ class ProductsRenderer
end
def product_scoper
OpenFoodNetwork::ScopeProductToHub.new(distributor)
@product_scoper ||= OpenFoodNetwork::ScopeProductToHub.new(distributor)
end
def enterprise_fee_calculator