Merge branch 'fix_redirecttofirstviewifnecessary' into feat_calendar

This commit is contained in:
benimautner 2024-04-05 08:58:09 +02:00
commit 2390c7f4a8
2 changed files with 5 additions and 2 deletions

View File

@ -9,10 +9,10 @@
<div
class="switch-view-container d-print-none"
:class="{'is-justify-content-flex-end': views.length === 1}"
:class="{'is-justify-content-flex-end': (views && views.length === 1)}"
>
<div
v-if="views.length > 1"
v-if="(views && views.length > 1)"
class="switch-view"
>
<BaseButton

View File

@ -30,6 +30,9 @@ function redirectToFirstViewIfNecessary() {
if (viewId === 0 || !projectStore.projects[projectId]?.views.find(v => v.id === viewId)) {
// Ideally, we would do that in the router redirect, but the projects (and therefore, the views)
// are not always loaded then.
if(!projectStore.projects[projectId]?.views || projectStore.projects[projectId]?.views.length == 0) {
return
}
const firstViewId = projectStore.projects[projectId]?.views[0].id
if (firstViewId) {
router.replace({