From 495a682926d7428a95b7e54125d8c2a573c85a6b Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Mon, 17 Nov 2025 22:54:07 +0500 Subject: [PATCH] fix: do not reload multiple tabs on block save (#2600) --- src/course-unit/hooks.jsx | 4 ++-- src/editors/data/redux/thunkActions/app.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/course-unit/hooks.jsx b/src/course-unit/hooks.jsx index 1109c5c8a..b987599ee 100644 --- a/src/course-unit/hooks.jsx +++ b/src/course-unit/hooks.jsx @@ -24,6 +24,7 @@ import { fetchCourseVerticalChildrenData, getCourseOutlineInfoQuery, patchUnitItemQuery, + updateCourseUnitSidebar, } from './data/thunk'; import { getCanEdit, @@ -231,8 +232,7 @@ export const useCourseUnit = ({ courseId, blockId }) => { // edits the component using editor which has a separate store /* istanbul ignore next */ if (event.key === 'courseRefreshTriggerOnComponentEditSave') { - dispatch(fetchCourseSectionVerticalData(blockId, sequenceId)); - dispatch(fetchCourseVerticalChildrenData(blockId, isSplitTestType)); + dispatch(updateCourseUnitSidebar(blockId)); localStorage.removeItem(event.key); } }; diff --git a/src/editors/data/redux/thunkActions/app.js b/src/editors/data/redux/thunkActions/app.js index 4c5079a5a..bc71c71b3 100644 --- a/src/editors/data/redux/thunkActions/app.js +++ b/src/editors/data/redux/thunkActions/app.js @@ -126,9 +126,9 @@ export const saveBlock = (content, returnToUnit) => (dispatch) => { onSuccess: (response) => { dispatch(actions.app.setSaveResponse(response)); const parsedData = JSON.parse(response.config.data); - if (parsedData?.has_changes) { + if (parsedData?.has_changes || !('has_changes' in parsedData)) { const storageKey = 'courseRefreshTriggerOnComponentEditSave'; - localStorage.setItem(storageKey, Date.now()); + sessionStorage.setItem(storageKey, Date.now()); window.dispatchEvent(new StorageEvent('storage', { key: storageKey,