From 442cd41d3915b2366665a780c08530481258f6ed Mon Sep 17 00:00:00 2001 From: Anis SMAIL Date: Wed, 18 Dec 2024 17:09:00 +0100 Subject: [PATCH] refactor(ui): small refactor --- .../App/Studies/StudyTree/index.tsx | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/webapp/src/components/App/Studies/StudyTree/index.tsx b/webapp/src/components/App/Studies/StudyTree/index.tsx index b037f4814f..510d70134e 100644 --- a/webapp/src/components/App/Studies/StudyTree/index.tsx +++ b/webapp/src/components/App/Studies/StudyTree/index.tsx @@ -36,20 +36,12 @@ function StudyTree() { const dispatch = useAppDispatch(); const [t] = useTranslation(); - //////////////////////////////////////////////////////////////// - // initialize - //////////////////////////////////////////////////////////////// - // Initialize folders once we have the tree // we use useUpdateEffectOnce because at first render initialStudiesTree isn't initialized useUpdateEffectOnce(() => { updateTree("root", initialStudiesTree); }, [initialStudiesTree]); - //////////////////////////////////////////////////////////////// - // utils - //////////////////////////////////////////////////////////////// - /** * This function is called at the initialization of the component and when the user clicks on a folder. * @@ -85,13 +77,12 @@ function StudyTree() { ); } } else { - /* If the user clicks on a folder, we add the path of the clicked folder to the list of paths to fetch. - * as well as the path of the children of the clicked folder. - * If we don't fetch the subfolders of the children then we won't know if they're themselves folders, which we need - * to know to display the little arrow next to the subfolder. - * On the other hand, if we fetch only the subfolders of the children, then we won't fetch their "siblings" folder - * if one of them is added. - */ + // If the user clicks on a folder, we add the path of the clicked folder to the list of paths to fetch. + // as well as the path of the children of the clicked folder. + // If we don't fetch the subfolders of the children then we won't know if they're themselves folders, which we need + // to know to display the little arrow next to the subfolder. + // On the other hand, if we fetch only the subfolders of the children, then we won't fetch their "siblings" folder + // if one of them is added. chidrenPaths = [studyTreeNode.path].concat(chidrenPaths); }