Skip to content

Commit

Permalink
fix(AU-2174): Fix left sidebar throwing 404
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodra committed Dec 17, 2024
1 parent 3811f5f commit eceddfc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/courseware/course/sidebar/sidebars/course-outline/hooks.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { useContext, useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { useParams } from 'react-router-dom';

import { useModel } from '@src/generic/model-store';
import SidebarContext from '@src/courseware/course/sidebar/SidebarContext';
import OldSidebarContext from '@src/courseware/course/sidebar/SidebarContext';
import NewSidebarContext from '@src/courseware/course/new-sidebar/SidebarContext';
import { getCoursewareOutlineSidebarSettings } from '@src/courseware/data/selectors';
import { ID } from './constants';

// eslint-disable-next-line import/prefer-default-export
export const useCourseOutlineSidebar = () => {
const isCollapsedOutlineSidebar = window.sessionStorage.getItem('hideCourseOutlineSidebar');
const { enableNavigationSidebar: isEnabledSidebar } = useSelector(getCoursewareOutlineSidebarSettings);
const { courseId } = useParams();
const course = useModel('coursewareMeta', courseId);
const { isNewDiscussionSidebarViewEnabled } = useModel('courseHomeMeta', courseId);
const SidebarContext = isNewDiscussionSidebarViewEnabled ? NewSidebarContext : OldSidebarContext;

const {
unitId,
courseId,
initialSidebar,
currentSidebar,
toggleSidebar,
Expand All @@ -22,7 +28,6 @@ export const useCourseOutlineSidebar = () => {
const isOpenSidebar = !initialSidebar && isEnabledSidebar && !isCollapsedOutlineSidebar;
const [isOpen, setIsOpen] = useState(true);

const course = useModel('coursewareMeta', courseId);
const {
entranceExamEnabled,
entranceExamPassed,
Expand Down

0 comments on commit eceddfc

Please sign in to comment.