Repository navigation
[FEATURE] Group the sidebar's connections in collapsible sections #1170
Description
Activity
- addedhelp wantedExtra attention is neededExtra attention is needed
on Oct 2, 2026 I'd like to take this one. I've shipped a few PRs here (#994, #1122, #1175) and the sidebar and preference-storage side (
favorite_connections/connection_order) is territory I can work in.I'll wait for the design questions above to be settled before writing code, especially the star-versus-group conflict. Once @cevheri has picked a reading, I'll start with the tests, per the repo's coverage gate. Could this be assigned to me when you're ready?
- addedenhancementNew feature or requestNew feature or request
on Oct 2, 2026 Thank you @yizhixiaokong for raising this. Twenty connections in one flat list is a real problem, and your proposal to reuse the
Favoritesshape made the design much easier to settle.Thank you @nawazish2 for picking it up, and for waiting on the design before writing code. The issue is assigned to you. Below are the decisions, then the path I would take through the code. When you open the PR, please link this comment in the description as the spec it follows, and add
Closes #1170.Decisions
- The star becomes a mark (reading 2). A starred row stays in its own section and also appears under
Favorites. This applies whether or not the user has any groups, so it is one rule everywhere. It intentionally changes today's behaviour, so the testa favorited connection renders once, under Favorites, not duplicated under Connections(tests/components/sidebar/ConnectionsList.test.tsx:352) gets rewritten to pin the new rule, and the PR description should say so. - Seed connections are ordinary rows. No fixed section: they start ungrouped and can be moved into a group like any other connection. Managed rows keep their lock icon.
- A
Move to groupcontrol on the row, built with the existingsrc/components/ui/dropdown-menu.tsx: it lists the groups,UngroupedandNew group.... No Group field in the connection form, because a managed connection cannot be edited there and membership is a preference, not part of the connection record. Drag onto a section header can come later as a follow-up. - No groups means no visible change in layout: one
Connectionssection, as today. Once at least one group exists, connections without a group render underUngrouped, and that section is hidden while it is empty. Deleting a group never deletes a connection: its members fall back toUngrouped. - Each header shows a count and is collapsible, and the collapsed state is stored per user with the groups themselves. A collapsed section still shows its header and count.
- Search and narrow sidebar are out of scope. This panel has no search box and no narrow mode today, so there is nothing to adapt.
- Reordering the groups themselves is out of scope for this PR. New groups append at the end. Please open a follow-up issue for group reordering once this lands.
Suggested path, test first at each step
The closest precedent is #817 (drag-and-drop reordering, #748). It added
connection_orderand touched the same files this change needs, so it is a good map to read first.- Storage. Add a
connection_groupscollection insrc/lib/storage/types.ts, an ordered array of{ id, name, collapsed, connectionIds }, with a docblock that explains why it lives outsideDatabaseConnection(the same reason asfavorite_connections: managed connections are replaced on every load). Add it toSTORAGE_COLLECTIONS, add a getter and setter insrc/lib/storage/storage-facade.ts, and remove a deleted connection's id from its group indeleteConnection, next to the existing favorites and order pruning. Wire both places insrc/hooks/use-storage-sync.tsthat handleconnection_order, and update the threedocs/STORAGE.mdspots that list the collections. Tests:tests/unit/lib/storage/storage-facade.test.tsandtests/isolated/use-storage-sync.test.ts. - A pure section builder. Put the layout logic in
src/lib/connection-groups.ts: given the already ordered connections (fromapplyConnectionOrder), the groups and the favorite ids, return the list of sections to render. Within every section, rows keep the one savedconnection_order, exactly asFavoritesdoes today. Unit-test it intests/unit/lib/connection-groups.test.ts, covering no groups, emptyUngrouped, a stale id in a group, and a starred row in a group. Keeping this pure keeps the component simple and makes 100% coverage easy. - A hook.
src/hooks/use-connection-groups.ts, modelled onuse-connection-order.ts: create, rename, delete, move a connection, toggle collapsed. A connection belongs to at most one group, so moving it removes it from the previous one. Tests intests/hooks/. - The list. In
src/components/sidebar/ConnectionsList.tsx, render the sections from step 2. ExtendSectionHeaderwith the count and a collapse button witharia-expanded;src/components/ui/collapsible.tsxis available. Rename and Delete for a group go in a small menu on its header, andNew groupin the panel header. Because a starred row now renders twice, the drag state must record the section as well as the id, otherwise both copies highlight. Dragging stays within one section, generalising today'sinSameSection. - The row. Add the
Move to groupcontrol tosrc/components/sidebar/ConnectionItem.tsx, with tests intests/components/sidebar/ConnectionItem.test.tsx. - Wiring. Pass the new props through
src/components/sidebar/Sidebar.tsxand bothConnectionsListcall sites insrc/components/Studio.tsx(desktop and mobile), with tests intests/components/Studio.test.tsxandtests/components/sidebar/Sidebar.test.tsx.
Before opening the PR
Run the gate set from
CLAUDE.md(format,lint,typecheck,knip, the four:checkscripts,test,build), thenbun run test:coverage && bun run coverage:check, which prints any uncovered lines. Please attach before and after screenshots of the panel with two groups, one starred row inside a group, and one collapsed section.If any of the above does not fit once you are in the code, say so here before working around it, and we will adjust the decision together.
- The star becomes a mark (reading 2). A starred row stays in its own section and also appears under
- added a commit that references this issue
on Oct 2, 2026
The Connections panel is one flat list with a
Favoritessection above it, so twenty connections have no way tobe kept apart. What I propose is the same sectioning, made user-defined: collapsible sections, in this panel
only, for the connections the user added.
Today:
With sections:
The shape follows
Favorites: a small label, a count, a hairline, and the connection rows under it at the sameindent they have today. The header becomes collapsible, and the sections are ordered as the user wants them. The
group membership is one more user preference next to
favorite_connectionsandconnection_order, so nothingabout the connection records or the other places that list connections changes.
The one conflict to settle first: the star moves a row today.
favorite_connectionscuts the panel in two,and a favorited connection leaves the
Connectionssection to render underFavorites(a test pins that itrenders once, not twice). With user-defined sections that rule pulls a row out of its group: a starred connection
in
Productionwould leaveProduction, which reads as the group having lost a member. Three readings:Favoriteskeeps winning: the star still moves the row to the top section, and its group is remembered butnot shown while it is starred.
Favorites. This changes today'srule, and it is the reading I would pick, because "which group it is in" and "pinned to the top" stay
independent and no group silently loses a member.
Favoritesbecomes a group of its own: the star moves the connection into it like any other group, so aconnection lives in exactly one place. Then there is no favorite inside
Production, and drag and dropalready does what the star would do.
The rest of what I would like your view on
Move to groupitem in the row menu,or a Group field in the connection form?
Ungroupedsection, or does the panel hide it while it is empty? When a group is deleted,do its connections fall back to
Ungrouped?Once the shape is settled, the implementation and its tests are a small piece of work.