Bug - sidebar opening (#1084)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-11-01 11:34:28 -03:00 • committed by GitHub
commit 58f83aaa98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -8,7 +8,7 @@ export default function DisclosureComponent({
openDisc, openDisc,
}: DisclosureComponentType): JSX.Element { }: DisclosureComponentType): JSX.Element {
return ( return (
<Disclosure as="div" key={title}> <Disclosure as="div" defaultOpen={openDisc} key={title}>
{({ open }) => ( {({ open }) => (
<> <>
<div> <div>
@ -35,9 +35,7 @@ export default function DisclosureComponent({
</div> </div>
</Disclosure.Button> </Disclosure.Button>
</div> </div>
<Disclosure.Panel as="div" static={openDisc}> <Disclosure.Panel as="div">{children}</Disclosure.Panel>
{children}
</Disclosure.Panel>
</> </>
)} )}
</Disclosure> </Disclosure>

View file

@ -122,7 +122,7 @@ export default function ExtraSidebar(): JSX.Element {
} }
} }
}); });
setSearch("search"); setSearch("");
return ret; return ret;
}); });
} }
@ -227,8 +227,12 @@ export default function ExtraSidebar(): JSX.Element {
.map((SBSectionName: keyof APIObjectType, index) => .map((SBSectionName: keyof APIObjectType, index) =>
Object.keys(dataFilter[SBSectionName]).length > 0 ? ( Object.keys(dataFilter[SBSectionName]).length > 0 ? (
<DisclosureComponent <DisclosureComponent
openDisc={search.length == 0 ? false : true} openDisc={
key={index} getFilterEdge.length !== 0 || search.length !== 0
? true
: false
}
key={index + search + JSON.stringify(getFilterEdge)}
button={{ button={{
title: nodeNames[SBSectionName] ?? nodeNames.unknown, title: nodeNames[SBSectionName] ?? nodeNames.unknown,
Icon: Icon: