Skip to content

Commit 14e122a

Browse files
authored
fix: do not reload multiple tabs on block save (backport openedx#2600) (openedx#2704)
1 parent f459f53 commit 14e122a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/course-unit/hooks.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
fetchCourseVerticalChildrenData,
2222
getCourseOutlineInfoQuery,
2323
patchUnitItemQuery,
24+
updateCourseUnitSidebar,
2425
} from './data/thunk';
2526
import {
2627
getCanEdit,
@@ -221,8 +222,7 @@ export const useCourseUnit = ({ courseId, blockId }) => {
221222
// edits the component using editor which has a separate store
222223
/* istanbul ignore next */
223224
if (event.key === 'courseRefreshTriggerOnComponentEditSave') {
224-
dispatch(fetchCourseSectionVerticalData(blockId, sequenceId));
225-
dispatch(fetchCourseVerticalChildrenData(blockId, isSplitTestType));
225+
dispatch(updateCourseUnitSidebar(blockId));
226226
localStorage.removeItem(event.key);
227227
}
228228
};

src/editors/data/redux/thunkActions/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export const saveBlock = (content, returnToUnit) => (dispatch) => {
126126
onSuccess: (response) => {
127127
dispatch(actions.app.setSaveResponse(response));
128128
const parsedData = JSON.parse(response.config.data);
129-
if (parsedData?.has_changes) {
129+
if (parsedData?.has_changes || !('has_changes' in parsedData)) {
130130
const storageKey = 'courseRefreshTriggerOnComponentEditSave';
131-
localStorage.setItem(storageKey, Date.now());
131+
sessionStorage.setItem(storageKey, Date.now());
132132

133133
window.dispatchEvent(new StorageEvent('storage', {
134134
key: storageKey,

0 commit comments

Comments
 (0)