website icon indicating copy to clipboard operation
website copied to clipboard

API Structures Sidebar Not Alphabetized

Open dsanders11 opened this issue 1 year ago • 3 comments

New additions to "API Structures" on the sidebar aren't alphabetized, which is confusing since the large majority of them are, and the other sections like modules are alphabetized.

Screenshot 2023-04-18 at 10 12 53 PM

dsanders11 avatar Apr 19 '23 05:04 dsanders11

@dsanders11 Addressed this issue in PR 👍

abhishekgite446 avatar Jun 27 '23 09:06 abhishekgite446

Hey @dsanders11 , I can see two solutions for this issue:

  1. We can sort the items when we are inserting an element into the array, which means changes in scripts/tasks/create-sidebar.ts, runs. (It seems like we have to sort the array every time an element is pushed.)

  2. Alternatively, we can edit theme/DocPage/Layout/index.tsx and sort the array as we fetch all items from sidebar.js. This way, before passing the array to DocPageLayoutSidebar, we can ensure it's sorted. This seems like a better approach as it avoids changing the script of create-sidebar.js, and the sort function won't run unnecessarily multiple times.

Current data is like this

[ 
Main Process Modules :{Array of links(item) - currently sorting these links}, 
Renderer Process Modules : { },
Custom DOM Elements : { }
Chromium and Node.js : { } , 
Classes: { }
] 

So we are already sorting Array of links present inside each element. How about sorting array of Elements also as it is not currently sorted?

I have implemented and tested all of these solutions, and they are working as expected! Let me know your opinion, and then I will proceed to generate a PR.

ashishsoniii avatar Feb 24 '24 13:02 ashishsoniii

Hey, @dsanders11 i maded a pr based on your guidance pls review the above pr

botPuneet avatar Mar 01 '24 09:03 botPuneet