Skip to content

Commit

Permalink
chore(QTabs): shorter algorithm for onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Sep 30, 2022
1 parent f5671d5 commit 5221ac1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ui/src/components/tabs/QTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,17 @@ export default Vue.extend({
// if requiring to go to another route, then we
// let the QTabs route watcher do its job,
// otherwise directly select this
let failed
const reqId = sameInternalRoute === true
? (this.$tabs.avoidRouteWatcher = uid())
: null

return this.$router[replace === true ? 'replace' : 'push'](resolvedLink.location)
.then(() => {
if (reqId === this.$tabs.avoidRouteWatcher) {
this.$tabs.__updateModel({ name: this.name })
}
})
.catch(() => {})
.catch(() => { failed = true })
.finally(() => {
if (reqId === this.$tabs.avoidRouteWatcher) {
this.$tabs.avoidRouteWatcher = false
failed !== true && this.$tabs.__updateModel({ name: this.name })
}
})
}
Expand Down

0 comments on commit 5221ac1

Please sign in to comment.