Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,13 @@
this.elevated = false; // list starts at top, so don't elevate toolbar
// NOTE: this may be redundant with the same call in TreeView.created
// for initial page load
this.loadAncestors({ id: this.topicId }).then(() => {
this.updateTitleForPage();
this.loadingAncestors = false;
this.removeContentNodes({ parentId: this.topicId }).then(success => {
if (success) {
this.loadAncestors({ id: this.topicId }).then(() => {
this.updateTitleForPage();
this.loadingAncestors = false;
});
}
});
},
immediate: true,
Expand Down Expand Up @@ -587,6 +591,7 @@
'waitForCopyingStatus',
'setQuickEditModal',
'updateContentNode',
'removeContentNodes',
]),
...mapMutations('contentNode', ['CLEAR_INHERITING_NODES']),
...mapActions('clipboard', ['copyAll']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
},
created() {
this.loading = true;
this.clearContentNodes().then(success => {
this.removeContentNodes({ parent: this.parentId }).then(success => {
if (success) {
this.loadChildren({ parent: this.parentId }).then(childrenResponse => {
this.loading = false;
Expand All @@ -134,7 +134,7 @@
'loadChildren',
'loadContentNodes',
'setContentNodesCount',
'clearContentNodes',
'removeContentNodes',
]),
goToNodeDetail(nodeId) {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ export function setContentNodesCount(context, nodes) {
}
}

export function clearContentNodes(context) {
export function removeContentNodes(context, { parentId }) {
return new Promise(resolve => {
context.commit('CLEAR_CONTENTNODES');
context.commit('REMOVE_CONTENTNODES_BY_PARENT', parentId);
resolve(true);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,15 @@ export function SET_CONTENTNODES_COUNT(state, { id, assessment_item_count, resou
}

/**
* Clears all content node data (nodes and associated counts) from the vuex state.
* Removes content nodes from the contentNodesMap by parent id.
* @param state - The vuex state
* @param parentId - The parent content node id
*/
export function CLEAR_CONTENTNODES(state) {
state.contentNodesMap = {};
export function REMOVE_CONTENTNODES_BY_PARENT(state, parentId) {
for (const key in state.contentNodesMap) {
if (state.contentNodesMap[key].parent === parentId) {
Vue.delete(state.contentNodesMap, key);
}
}
state.contentNodesCountMap = {};
}