-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/treeview #1132
feat/treeview #1132
Conversation
It reduces the VerticalSideBarLayout's size/responsabilities.
The `CatalogResourcesSideBar` is only used within `SideNav`, so colocating it improves organization and maintainability.
It lets the user choose between the sidebar type they want. The options are 'FLAT_VIEW' or 'TREE_VIEW'. The 'FLAT_VIEW' is the default type.
🦋 Changeset detectedLatest commit: ed7faf6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thanks @carlosallexandre I think this is great! A few things I wonder if we can add?
I wonder if getTreeView needs to be cached or not? Like we do other pages etc, for large catalogs, this tree view will be called multiple times or is it a build time thing? |
Also I'm working on a new feature that is moving users/teams away from the docs sidebars into their own views... just a heads up but that shoul dnot change this PR, keep them where they are |
I'll add this.
Great point! I'll add a caching layer to
This will be similar to the visualizer page, where |
`@primer/react` has a dependency conflict with another project dependency, which prevents proper hoisting to the root `node_modules` on client installation. This issue is similar to the current `pnpm` issue. Consider revisiting this once the `pnpm` issue is resolved.
Label nodes, which group items by type, are now expanded by default. Previously, they were collapsed by default.
Previously, tree nodes were only grouped if their parent was a service or if they had a sibling of different type. Now, all tree nodes are grouped by type for consistency.
`Teams` and `users` are leaf nodes and do not require additional nesting. Added an early return after processing them to improve readability and avoid unnecessary checks for `index.md`
- Renamed `traverse` to `buildTreeOfDir` for clairty. - Introduced `forEachTreeNodeOf` to apply transformations cleanly. - Extracted `addHrefToNode`, `orderChildrenByName` and `groupChildrenByType` to improve maintainability. - Improved overall readability and processing order.
- Implemented an in-memory caching layer using Map. - Prevents redundant computations for the same `projectDir`. - Improves performance by reducing file system calls.
Just dived deeper into things, removed some of those hooks I don't think we need some of them, and also refactored some the UI too |
Thank you @carlosallexandre just reviewed, tested and edited some things. Think this is great addition to the project, and I appreciate your patience and support mate. I'm happy to merge this, one question is there a place we got the useSlots and the treeview component? I might add this in the comments of the file, so future folks understand where its from and how it works |
Motivation
It adds another view type for sidebar. Now, the user could choose between
FLAT_VIEW
andTREE_VIEW
. TheFLAT_VIEW
is the default to keep compatibility with old versions.Related issues
Close #1065