Skip to content

Commit

Permalink
fix(ui-studies): display 'default' workspace even if empty (#2301)
Browse files Browse the repository at this point in the history
Co-authored-by: Anis SMAIL <[email protected]>
  • Loading branch information
smailio and Anis SMAIL authored Jan 24, 2025
1 parent 5c3f165 commit e300c94
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions webapp/src/components/App/Studies/StudyTree/__test__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ export const FIXTURES_BUILD_STUDY_TREE = {
name: "root",
path: "",
children: [
{
name: "default",
path: "/default",
children: [],
},
{
name: "workspace",
path: "/workspace",
Expand Down Expand Up @@ -270,6 +275,11 @@ export const FIXTURES_BUILD_STUDY_TREE = {
name: "root",
path: "",
children: [
{
name: "default",
path: "/default",
children: [],
},
{
name: "workspace",
path: "/workspace",
Expand Down
11 changes: 10 additions & 1 deletion webapp/src/components/App/Studies/StudyTree/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
};

Expand Down

0 comments on commit e300c94

Please sign in to comment.