Tracking navigation requests, if multiple, only finish on latest (#3403)

This commit is contained in:
Jamie V 2020-10-05 10:41:49 -07:00 committed by GitHub
parent db33f0538a
commit 5f7e34ce6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,10 +193,6 @@ export default {
}, },
watch: { watch: {
syncTreeNavigation() { syncTreeNavigation() {
if (this.isLoading) {
return;
}
const AND_SAVE_PATH = true; const AND_SAVE_PATH = true;
let currentLocationPath = this.openmct.router.currentLocation.path; let currentLocationPath = this.openmct.router.currentLocation.path;
let hasParent = this.currentlyViewedObjectParentPath() || (this.multipleRootChildren && !this.currentlyViewedObjectParentPath()); let hasParent = this.currentlyViewedObjectParentPath() || (this.multipleRootChildren && !this.currentlyViewedObjectParentPath());
@ -441,6 +437,9 @@ export default {
} }
}, },
async getAllChildren(node) { async getAllChildren(node) {
let currentNavigationRequest = this.openmct.objects.makeKeyString(node.object.identifier);
this.latestNavigationRequest = currentNavigationRequest;
await this.clearVisibleItems(); await this.clearVisibleItems();
this.isLoading = true; this.isLoading = true;
@ -455,7 +454,10 @@ export default {
this.composition.on('add', this.addChild); this.composition.on('add', this.addChild);
this.composition.on('remove', this.removeChild); this.composition.on('remove', this.removeChild);
await this.composition.load(); await this.composition.load();
this.finishLoading();
if (currentNavigationRequest === this.latestNavigationRequest) {
this.finishLoading();
}
}, },
buildTreeItem(domainObject) { buildTreeItem(domainObject) {
let navToParent = ROOT_PATH + this.currentNavigatedPath; let navToParent = ROOT_PATH + this.currentNavigatedPath;
@ -636,20 +638,12 @@ export default {
this.setContainerHeight(); this.setContainerHeight();
}, },
handleReset(node) { handleReset(node) {
if (this.isLoading) {
return;
}
this.childrenSlideClass = 'up'; this.childrenSlideClass = 'up';
this.ancestors.splice(this.ancestors.indexOf(node) + 1); this.ancestors.splice(this.ancestors.indexOf(node) + 1);
this.getAllChildren(node); this.getAllChildren(node);
this.setCurrentNavigatedPath(); this.setCurrentNavigatedPath();
}, },
handleExpanded(node) { handleExpanded(node) {
if (this.activeSearch || this.isLoading) {
return;
}
this.childrenSlideClass = 'down'; this.childrenSlideClass = 'down';
let newParent = this.buildTreeItem(node); let newParent = this.buildTreeItem(node);
this.ancestors.push(newParent); this.ancestors.push(newParent);