From 322ae08eb9ca4f90b370b760fe2b5e8d7678cec5 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 20 Mar 2022 02:08:46 -0500 Subject: [PATCH] fix: controlled --- packages/core/src/components/persea/resource/index.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/src/components/persea/resource/index.jsx b/packages/core/src/components/persea/resource/index.jsx index dad7bda..c7b7b8a 100644 --- a/packages/core/src/components/persea/resource/index.jsx +++ b/packages/core/src/components/persea/resource/index.jsx @@ -31,6 +31,7 @@ function Resource({expanded}) { const {current} = useSelector(resourceSelector); const openResources = useSelector(openResourcesSelector); const projects = Object.entries(structure); + const selectedIndex = openResources.findIndex(({uri}) => current === uri); const resource = useSelector((state) => projectResourceSelector(state, project, current)); if (!resource) { dispatch(fetchProjectResource({uri: current, uuid: project})); @@ -41,6 +42,7 @@ function Resource({expanded}) { onSelect={(index) => { dispatch(setCurrentResource(openResources[index].uri)); }} + selectedIndex={selectedIndex} > {