fix(extraSidebarComponent): sort the keys in dataFilter object with a custom sorting function to prioritize "saved_components" key

This commit is contained in:
anovazzi1 2023-11-23 16:38:54 -03:00
commit 9db5f90acf

View file

@ -305,7 +305,15 @@ export default function ExtraSidebar(): JSX.Element {
<div className="side-bar-components-div-arrangement">
{Object.keys(dataFilter)
.sort()
.sort((a, b) => {
if (a.toLowerCase() === "saved_components") {
return -1;
} else if (b.toLowerCase() === "saved_components") {
return 1;
} else {
return a.localeCompare(b);
}
})
.map((SBSectionName: keyof APIObjectType, index) =>
Object.keys(dataFilter[SBSectionName]).length > 0 ? (
<DisclosureComponent