fix(project): do not crash when views were not loaded yet

The project view crashed when accessing a task from /projects because the currentProject in store was not set, hence the views weren't set either. This change adds a fallback to it.

Related to vikunja/vikunja#2246
Related to https://community.vikunja.io/t/vikunja-freezes/2246/5
This commit is contained in:
kolaente 2024-04-13 13:18:14 +02:00
parent 73bf119409
commit 9eb19e0362
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ const currentProject = computed<IProject>(() => {
})
useTitle(() => currentProject.value?.id ? getProjectTitle(currentProject.value) : '')
const views = computed(() => currentProject.value?.views)
const views = computed(() => currentProject.value?.views || [])
// watchEffect would be called every time the prop would get a value assigned, even if that value was the same as before.
// This resulted in loading and setting the project multiple times, even when navigating away from it.