fix(task): do not crash when loading a task if parent projects are not loaded
Related to https://community.vikunja.io/t/vikunja-freezes/2246 Related to https://github.com/go-vikunja/vikunja/issues/233
This commit is contained in:
parent
a3e5e98c64
commit
0bc9a670d7
@ -207,13 +207,17 @@ export const useProjectStore = defineStore('project', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAncestors(project: IProject): IProject[] {
|
function getAncestors(project: IProject): IProject[] {
|
||||||
|
if (typeof project === 'undefined') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
if (!project?.parentProjectId) {
|
if (!project?.parentProjectId) {
|
||||||
return [project]
|
return [project]
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentProject = projects.value[project.parentProjectId]
|
const parentProject = projects.value[project.parentProjectId]
|
||||||
return [
|
return [
|
||||||
...getAncestors(parentProject),
|
...(parentProject ? getAncestors(parentProject) : []),
|
||||||
project,
|
project,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user