From a3fceeb73aae9f385b6aca600736b5455fa55c9a Mon Sep 17 00:00:00 2001 From: Victor Campos Date: Thu, 9 Jan 2025 17:10:50 -0600 Subject: [PATCH 1/2] fix: adding global state to the dependency array --- apps/storefront/src/components/HeadlessController.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/storefront/src/components/HeadlessController.tsx b/apps/storefront/src/components/HeadlessController.tsx index a49ca839..070700dd 100644 --- a/apps/storefront/src/components/HeadlessController.tsx +++ b/apps/storefront/src/components/HeadlessController.tsx @@ -251,9 +251,7 @@ export default function HeadlessController({ setOpenPage }: HeadlessControllerPr }, }, }; - // disabling because we don't want to run this effect on every render - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [productList, B2BToken]); + }, [productList, B2BToken, globalState]); return null; } From 325257edea681dab5b0e4bce2bbc028a53f1f536 Mon Sep 17 00:00:00 2001 From: Victor Campos Date: Thu, 9 Jan 2025 17:14:31 -0600 Subject: [PATCH 2/2] fix: adding back eslint rule --- apps/storefront/src/components/HeadlessController.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/storefront/src/components/HeadlessController.tsx b/apps/storefront/src/components/HeadlessController.tsx index 070700dd..13cb264e 100644 --- a/apps/storefront/src/components/HeadlessController.tsx +++ b/apps/storefront/src/components/HeadlessController.tsx @@ -251,6 +251,8 @@ export default function HeadlessController({ setOpenPage }: HeadlessControllerPr }, }, }; + // disabling because we don't want to run this effect on every render + // eslint-disable-next-line react-hooks/exhaustive-deps }, [productList, B2BToken, globalState]); return null;