Skip to content

Commit 9dd79ca

Browse files
fix: fixed empty section issue (openedx#1292)
* fix: fixed empty section issue * refactor: added checks to hide view
1 parent 9bfa0d0 commit 9dd79ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/courseware/course/new-sidebar/Sidebar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import SidebarContext from './SidebarContext';
44
import { SIDEBARS } from './sidebars';
55

66
const Sidebar = () => {
7-
const { currentSidebar } = useContext(SidebarContext);
7+
const { currentSidebar, isDiscussionbarAvailable, isNotificationbarAvailable } = useContext(SidebarContext);
88

9-
if (currentSidebar === null) { return null; }
9+
if (currentSidebar === null || (!isDiscussionbarAvailable && !isNotificationbarAvailable)) { return null; }
1010
const SidebarToRender = SIDEBARS[currentSidebar].Sidebar;
1111

1212
return (

src/courseware/course/new-sidebar/SidebarContextProvider.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const SidebarProvider = ({
3232
);
3333
const topic = useModel('discussionTopics', unitId);
3434
const { verifiedMode } = useModel('courseHomeMeta', courseId);
35-
const isDiscussionbarAvailable = topic?.id && topic?.enabledInContext;
35+
const isDiscussionbarAvailable = (topic?.id && topic?.enabledInContext) || false;
3636
const isNotificationbarAvailable = !isEmpty(verifiedMode);
3737

3838
const onNotificationSeen = useCallback(() => {

0 commit comments

Comments
 (0)