diff --git a/src/courseware/course/sidebar/SidebarContextProvider.jsx b/src/courseware/course/sidebar/SidebarContextProvider.jsx index 84dfa1dfdd..05472c01dd 100644 --- a/src/courseware/course/sidebar/SidebarContextProvider.jsx +++ b/src/courseware/course/sidebar/SidebarContextProvider.jsx @@ -28,8 +28,8 @@ const SidebarProvider = ({ const { alwaysOpenAuxiliarySidebar } = useSelector(getCoursewareOutlineSidebarSettings); const isInitiallySidebarOpen = shouldDisplaySidebarOpen || query.get('sidebar') === 'true'; - let initialSidebar = null; - if (isInitiallySidebarOpen && alwaysOpenAuxiliarySidebar) { + let initialSidebar = shouldDisplayFullScreen ? getLocalStorage(`sidebar.${courseId}`) : null; + if (!shouldDisplayFullScreen && isInitiallySidebarOpen && alwaysOpenAuxiliarySidebar) { initialSidebar = isUnitHasDiscussionTopics ? SIDEBARS[discussionsSidebar.ID].ID : verifiedMode && SIDEBARS[notificationsSidebar.ID].ID; @@ -57,7 +57,9 @@ const SidebarProvider = ({ const toggleSidebar = useCallback((sidebarId) => { // Switch to new sidebar or hide the current sidebar - setCurrentSidebar(sidebarId === currentSidebar ? null : sidebarId); + const newSidebar = sidebarId === currentSidebar ? null : sidebarId; + setCurrentSidebar(newSidebar); + setLocalStorage(`sidebar.${courseId}`, newSidebar); }, [currentSidebar]); const contextValue = useMemo(() => ({ diff --git a/src/courseware/data/thunks.js b/src/courseware/data/thunks.js index 54eb5d1666..7222d357bf 100644 --- a/src/courseware/data/thunks.js +++ b/src/courseware/data/thunks.js @@ -113,7 +113,7 @@ export function fetchCourse(courseId) { logError(courseHomeMetadataResult.reason); } if (!fetchedCoursewareOutlineSidebarTogglesResult) { - logError(fetchedCoursewareOutlineSidebarTogglesResult.reason); + logError(coursewareOutlineSidebarTogglesResult.reason); } if (fetchedMetadata && fetchedCourseHomeMetadata) { if (courseHomeMetadataResult.value.courseAccess.hasAccess && fetchedOutline) {