fix: controlled

This commit is contained in:
cha0s 2022-03-20 02:08:46 -05:00
parent 4e7d75727c
commit 322ae08eb9

View File

@ -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}
>
<TabList>
{