Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes setMainNavBackButton race condition before a team is present after logging in #4949

Merged
merged 2 commits into from
Dec 20, 2024
Merged
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
20 changes: 11 additions & 9 deletions frontend/src/components/drawers/navigation/MainNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
backToButton () {
const defaultBackToRoute = {
label: 'Back to Dashboard',
to: { name: 'Applications', params: { team_slug: this.team.slug } },
to: { name: 'Applications', params: { team_slug: this.team?.slug } },
tag: 'back',
icon: ChevronLeftIcon
}
Expand All @@ -93,7 +93,7 @@ export default {
return { ...defaultBackToRoute, ...this.nearestMetaMenu.backTo }

case isNearestMenuAnObject && hasBackToProp && typeof this.nearestMetaMenu.backTo === 'function':
return { ...defaultBackToRoute, ...this.nearestMetaMenu.backTo({ team_slug: this.team.slug }) }
return { ...defaultBackToRoute, ...this.nearestMetaMenu.backTo({ team_slug: this.team?.slug }) }

case typeof this.nearestMetaMenu === 'string':
default:
Expand All @@ -107,23 +107,25 @@ export default {
watch: {
nearestContextualMenu: {
handler: function (menu) {
if (Object.keys(this.mainNavContexts).includes(menu)) {
this.setMainNavContext(menu)
}
this.setMainNavContext(menu)
},
immediate: true
},
backToButton: {
handler: function (menu) {
this.setMainNavBackButton(menu)
},
handler: 'setBackButton',
immediate: true
}
},
team: 'setBackButton'
},
methods: {
...mapActions('ux', ['setMainNavContext', 'setMainNavBackButton']),
onMenuItemClick () {
this.$store.dispatch('ux/closeLeftDrawer')
},
setBackButton () {
if (this.team) {
this.setMainNavBackButton(this.backToButton)
}
}
}
}
Expand Down
Loading