From 9eeba4adb4c26fb495d61803cdef2ee01905b712 Mon Sep 17 00:00:00 2001 From: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:26:00 -0500 Subject: [PATCH] cleaner filter --- .../factories/recommendation-static-state-factory.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/headless/src/app/commerce-ssr-engine/factories/recommendation-static-state-factory.ts b/packages/headless/src/app/commerce-ssr-engine/factories/recommendation-static-state-factory.ts index 6299c3d8cb8..643c937b7b6 100644 --- a/packages/headless/src/app/commerce-ssr-engine/factories/recommendation-static-state-factory.ts +++ b/packages/headless/src/app/commerce-ssr-engine/factories/recommendation-static-state-factory.ts @@ -169,11 +169,11 @@ function filterRecommendationControllers< const isRecommendationController = (key: string) => name.includes(key) && whitelist.includes(key); - Object.entries(controllers) - .filter(([key, _]) => isRecommendationController(key)) - .forEach(([_, controller]) => - (controller as Recommendations).refresh?.() - ); + for (const [key, controller] of Object.entries(controllers)) { + if (isRecommendationController(key)) { + (controller as Recommendations).refresh?.(); + } + } }, }; }