Skip to content

Commit 495a682

Browse files
authored
fix: do not reload multiple tabs on block save (#2600)
1 parent 6f41cd7 commit 495a682

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/course-unit/hooks.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
fetchCourseVerticalChildrenData,
2525
getCourseOutlineInfoQuery,
2626
patchUnitItemQuery,
27+
updateCourseUnitSidebar,
2728
} from './data/thunk';
2829
import {
2930
getCanEdit,
@@ -231,8 +232,7 @@ export const useCourseUnit = ({ courseId, blockId }) => {
231232
// edits the component using editor which has a separate store
232233
/* istanbul ignore next */
233234
if (event.key === 'courseRefreshTriggerOnComponentEditSave') {
234-
dispatch(fetchCourseSectionVerticalData(blockId, sequenceId));
235-
dispatch(fetchCourseVerticalChildrenData(blockId, isSplitTestType));
235+
dispatch(updateCourseUnitSidebar(blockId));
236236
localStorage.removeItem(event.key);
237237
}
238238
};

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)