diff --git a/webapp/src/components/App/Studies/StudyTree/__test__/fixtures.ts b/webapp/src/components/App/Studies/StudyTree/__test__/fixtures.ts index 5ac08ebfb2..616d018500 100644 --- a/webapp/src/components/App/Studies/StudyTree/__test__/fixtures.ts +++ b/webapp/src/components/App/Studies/StudyTree/__test__/fixtures.ts @@ -238,6 +238,11 @@ export const FIXTURES_BUILD_STUDY_TREE = { name: "root", path: "", children: [ + { + name: "default", + path: "/default", + children: [], + }, { name: "workspace", path: "/workspace", @@ -270,6 +275,11 @@ export const FIXTURES_BUILD_STUDY_TREE = { name: "root", path: "", children: [ + { + name: "default", + path: "/default", + children: [], + }, { name: "workspace", path: "/workspace", diff --git a/webapp/src/components/App/Studies/StudyTree/utils.ts b/webapp/src/components/App/Studies/StudyTree/utils.ts index 87670d03e6..405ecb6ceb 100644 --- a/webapp/src/components/App/Studies/StudyTree/utils.ts +++ b/webapp/src/components/App/Studies/StudyTree/utils.ts @@ -23,9 +23,18 @@ import type { StudyTreeNode, NonStudyFolderDTO } from "./types"; * @returns A tree structure representing the studies. */ export function buildStudyTree(studies: StudyMetadata[]) { + // It is important to initialize the root node with the default workspace as a child + // Otherwise we won't see the default workspace if no study has a path (which only + // happens when a user moves a study to another folder) const tree: StudyTreeNode = { name: "root", - children: [], + children: [ + { + name: "default", + children: [], + path: "/default", + }, + ], path: "", };