diff --git a/frontend/src/stores/projects.ts b/frontend/src/stores/projects.ts index 7c9bbbe1c..34a580a16 100644 --- a/frontend/src/stores/projects.ts +++ b/frontend/src/stores/projects.ts @@ -207,13 +207,17 @@ export const useProjectStore = defineStore('project', () => { } function getAncestors(project: IProject): IProject[] { + if (typeof project === 'undefined') { + return [] + } + if (!project?.parentProjectId) { return [project] } const parentProject = projects.value[project.parentProjectId] return [ - ...getAncestors(parentProject), + ...(parentProject ? getAncestors(parentProject) : []), project, ] }