diff --git a/src/course-outline/CourseOutline.jsx b/src/course-outline/CourseOutline.jsx index e7468e68f..fe428c1c7 100644 --- a/src/course-outline/CourseOutline.jsx +++ b/src/course-outline/CourseOutline.jsx @@ -125,7 +125,8 @@ const CourseOutline = ({ courseId }) => { const [toastMessage, setToastMessage] = useState(/** @type{null|string} */ (null)); useEffect(() => { - if (location.hash === '#export-tags') { + // Wait for the course data to load before exporting tags. + if (courseId && courseName && location.hash === '#export-tags') { setToastMessage(intl.formatMessage(messages.exportTagsCreatingToastMessage)); getTagsExportFile(courseId, courseName).then(() => { setToastMessage(intl.formatMessage(messages.exportTagsSuccessToastMessage)); @@ -136,7 +137,7 @@ const CourseOutline = ({ courseId }) => { // Delete `#export-tags` from location window.location.href = '#'; } - }, [location]); + }, [location, courseId, courseName]); const [sections, setSections] = useState(sectionsList); diff --git a/src/header/hooks.js b/src/header/hooks.js index 9bcbd29e4..d4ce5fd0e 100644 --- a/src/header/hooks.js +++ b/src/header/hooks.js @@ -90,7 +90,7 @@ export const useToolsMenuItems = courseId => { }, ...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' ? [{ - href: '#export-tags', + href: `${studioBaseUrl}/course/${courseId}#export-tags`, title: intl.formatMessage(messages['header.links.exportTags']), }] : [] ),