diff --git a/src/discussions/discussions-home/DiscussionsHome.jsx b/src/discussions/discussions-home/DiscussionsHome.jsx index 2c858a544..93ee52756 100644 --- a/src/discussions/discussions-home/DiscussionsHome.jsx +++ b/src/discussions/discussions-home/DiscussionsHome.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from 'react'; +import React, { useEffect, useMemo, useRef } from 'react'; import classNames from 'classnames'; import { useSelector } from 'react-redux'; @@ -52,6 +52,7 @@ const DiscussionsHome = () => { /* Display the content area if we are currently viewing/editing a post or creating one. If the window is larger than a particular size, show the sidebar for navigating between posts/topics. However, for smaller screens or embeds, onlyshow the sidebar if the content area isn't displayed. */ + const inContext = new URLSearchParams(location.search).get('inContext') !== null; const displayContentArea = (postId || postEditorVisible || (learnerUsername && postId)); if (displayContentArea) { displaySidebar = isOnDesktop; } @@ -61,9 +62,8 @@ const DiscussionsHome = () => { } }, [path]); - return ( - // eslint-disable-next-line react/jsx-no-constructed-context-values - ( + { page, courseId, postId, @@ -71,10 +71,14 @@ const DiscussionsHome = () => { enableInContextSidebar, category, learnerUsername, - }} - > - {!enableInContextSidebar &&
} -
+ } + ), []); + + return ( + // eslint-disable-next-line react/jsx-no-constructed-context-values + + {!inContext &&
} +
{!enableInContextSidebar && }