diff --git a/src/containers/WidgetContainers/LoadedSidebar/index.jsx b/src/containers/WidgetContainers/LoadedSidebar/index.jsx index 8f5f2224c..119afd112 100644 --- a/src/containers/WidgetContainers/LoadedSidebar/index.jsx +++ b/src/containers/WidgetContainers/LoadedSidebar/index.jsx @@ -7,9 +7,21 @@ import hooks from 'widgets/ProductRecommendations/hooks'; export const WidgetSidebar = ({ setSidebarShowing }) => { const { inRecommendationsVariant, isExperimentActive } = hooks.useShowRecommendationsFooter(); - if (!inRecommendationsVariant && isExperimentActive) { - setSidebarShowing(true); + React.useEffect(() => { + if (!inRecommendationsVariant && isExperimentActive) { + setSidebarShowing(true); + return ( +
+
+ +
+
+ ); + } + return null; + }, [inRecommendationsVariant, isExperimentActive, setSidebarShowing]); + if (!inRecommendationsVariant && isExperimentActive) { return (
@@ -18,7 +30,6 @@ export const WidgetSidebar = ({ setSidebarShowing }) => {
); } - return null; }; diff --git a/src/containers/WidgetContainers/NoCoursesSidebar/index.jsx b/src/containers/WidgetContainers/NoCoursesSidebar/index.jsx index c3e669ad0..90e7f8303 100644 --- a/src/containers/WidgetContainers/NoCoursesSidebar/index.jsx +++ b/src/containers/WidgetContainers/NoCoursesSidebar/index.jsx @@ -7,9 +7,21 @@ import hooks from 'widgets/ProductRecommendations/hooks'; export const WidgetSidebar = ({ setSidebarShowing }) => { const { inRecommendationsVariant, isExperimentActive } = hooks.useShowRecommendationsFooter(); - if (!inRecommendationsVariant && isExperimentActive) { - setSidebarShowing(true); + React.useEffect(() => { + if (!inRecommendationsVariant && isExperimentActive) { + setSidebarShowing(true); + return ( +
+
+ +
+
+ ); + } + return null; + }, [inRecommendationsVariant, isExperimentActive, setSidebarShowing]); + if (!inRecommendationsVariant && isExperimentActive) { return (
@@ -18,7 +30,6 @@ export const WidgetSidebar = ({ setSidebarShowing }) => {
); } - return null; };