Skip to content

Commit

Permalink
fix(QTabs): correctly unwatch route at unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Sep 30, 2022
1 parent 68836ee commit 0ccf68f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ui/src/components/tabs/QTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,14 @@ export default Vue.extend({
return done
},

__getRouteTabVmList () {
return this.tabVmList.filter(tab => tab.hasRouterLink === true)
},

__hasActiveNonRouteTab () {
return this.tabVmList.some(tab => tab.hasRouterLink === void 0 && tab.name === this.currentModel)
},

// do not use directly; use __verifyRouteModel() instead
__updateActiveRoute () {
let name = null, best = getDefaultBestScore()
const vmList = this.__getRouteTabVmList()
const vmList = this.tabVmList.filter(tab => tab.hasRouterLink === true)
const vmLen = vmList.length

for (let tabIndex = 0; tabIndex < vmLen; tabIndex++) {
Expand Down Expand Up @@ -612,7 +608,10 @@ export default Vue.extend({
// if we're watching route and this tab is a QRouteTab
if (this.unwatchRoute !== void 0 && tabVm.hasRouterLink !== void 0) {
// unwatch route if we don't have any QRouteTabs left
this.__getRouteTabVmList().length === 0 && this.unwatchRoute()
if (this.tabVmList.every(tab => tab.hasRouterLink === void 0) === true) {
this.unwatchRoute()
}

// then update model
this.__verifyRouteModel()
}
Expand Down

0 comments on commit 0ccf68f

Please sign in to comment.