diff --git a/webapp/src/components/App/Studies/StudyTree/StudyTreeNode.tsx b/webapp/src/components/App/Studies/StudyTree/StudyTreeNode.tsx index e84b9592c9..7d3644f06f 100644 --- a/webapp/src/components/App/Studies/StudyTree/StudyTreeNode.tsx +++ b/webapp/src/components/App/Studies/StudyTree/StudyTreeNode.tsx @@ -12,7 +12,8 @@ * This file is part of the Antares project. */ -import { memo } from "react"; +import { memo, useMemo } from "react"; +import * as R from "ramda"; import type { StudyTreeNodeProps } from "./types"; import TreeItemEnhanced from "@/components/common/TreeItemEnhanced"; import { t } from "i18next"; @@ -25,6 +26,11 @@ export default memo(function StudyTreeNode({ const isLoadingFolder = studyTreeNode.hasChildren && studyTreeNode.children.length === 0; const id = parentId ? `${parentId}/${studyTreeNode.name}` : studyTreeNode.name; + const sortedChildren = useMemo( + () => R.sortBy(R.prop("name"), studyTreeNode.children), + [studyTreeNode.children], + ); + if (isLoadingFolder) { return ( onNodeClick(id, studyTreeNode)} > - {studyTreeNode.children.map((child) => ( + {sortedChildren.map((child) => (