Skip to content

Commit d14c2a9

Browse files
fix: sidebar not showing sections on pending courses (#1679)
1 parent b6c29df commit d14c2a9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/courseware/course/sidebar/sidebars/course-outline/CourseOutlineTray.jsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ChevronLeft as ChevronLeftIcon,
88
} from '@openedx/paragon/icons';
99

10-
import { useModel } from '@src/generic/model-store';
1110
import { LOADING } from '@src/constants';
1211
import PageLoading from '@src/generic/PageLoading';
1312
import SidebarSection from './components/SidebarSection';
@@ -35,13 +34,13 @@ const CourseOutlineTray = () => {
3534
sequences,
3635
} = useCourseOutlineSidebar();
3736

38-
const {
39-
sectionId: activeSectionId,
40-
} = useModel('sequences', activeSequenceId);
41-
37+
const resolvedSectionId = selectedSection
38+
|| Object.keys(sections).find(
39+
(sectionId) => sections[sectionId].sequenceIds.includes(activeSequenceId),
40+
);
4241
const sectionsIds = Object.keys(sections);
43-
const sequenceIds = sections[selectedSection || activeSectionId]?.sequenceIds || [];
44-
const backButtonTitle = sections[selectedSection || activeSectionId]?.title;
42+
const sequenceIds = sections[resolvedSectionId]?.sequenceIds || [];
43+
const backButtonTitle = sections[resolvedSectionId]?.title;
4544

4645
const handleBackToSectionLevel = () => {
4746
setDisplaySectionLevel();

0 commit comments

Comments
 (0)