From d8152177830f581dfbb830f44283d008c12ccc68 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Tue, 4 Nov 2025 12:42:05 +0500 Subject: [PATCH] fix: do not reload multiple tabs on block save --- 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 1109c5c8a6..b987599eea 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 4c5079a5a9..7a5f249458 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 || parsedData?.category === 'video') { const storageKey = 'courseRefreshTriggerOnComponentEditSave'; - localStorage.setItem(storageKey, Date.now()); + sessionStorage.setItem(storageKey, Date.now()); window.dispatchEvent(new StorageEvent('storage', { key: storageKey,