fix(extraSidebarComponent): sort the keys in dataFilter object with a custom sorting function to prioritize "saved_components" key
This commit is contained in:
parent
cdb7c1a695
commit
9db5f90acf
1 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue