Skip to content

feat(favorites): nest categories, and drag a favorite between them - #618

Merged
EVWorth merged 1 commit into
mainfrom
feat/favorites-nested-categories
Sep 10, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/favorites-nested-categories

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Closes #334. Last of the favorites audit.

FR-9.2.2 asks for hierarchical folders, and the flat categories: string[] was read as the whole of what was possible. It isn't: a category is a name, and a name can be a path. "Reports/Daily" is one category to the store and two folders to the user.

No migration, and a favorite saved under a flat name lands exactly where it always did.

Dragging a favorite onto a folder moves it. The drag carries a private text/sqlpilot-favorite type rather than text/plain, so dropping a file on the panel does nothing — and a row being renamed isn't draggable, since a drag started mid-edit would take the half-typed name with it.

The sharp edges are in the tree logic, so it's its own module

lib/category-tree.ts, 28 tests. Each of these is a case that would otherwise be found in the UI:

  • An intermediate folder is created even when nothing declared it, or a lone Reports/Daily leaves its nesting invisible.
  • A collapsed folder hides its descendants but stays visible, or there's nothing left to click to reopen it.
  • Reports Archive is not inside Reports, despite the prefix.
  • A folder can't be moved inside itself or its own descendant — that would detach the subtree and lose it.
  • Reports//Daily/ normalises to Reports/Daily; a stray separator is a typo, not a folder with no name.

One thing deliberately not built

Drag-reordering within a folder. Favorites sort by recency, and a manual order would be a second ordering to keep in step with nobody asking for it. FR-9.2.2 now says so rather than leaving it looking unfinished.

Verification

28 tree tests, 9 component tests. Unit 2127, browser 297, 0 lint errors.

FR-9.2.2 asks for hierarchical folders, and the flat `categories: string[]`
was read as the whole of what was possible (#334). It is not: a category is
a name, and a name can be a path. "Reports/Daily" is one category to the
store and two folders to the user.

No migration, and a favorite saved under a flat name lands exactly where it
always did. The separator is "/" because that is what people already type
when they mean nesting.

Dragging a favorite onto a folder moves it. The drag carries a private
`text/sqlpilot-favorite` type rather than text/plain, so dropping a file on
the panel does nothing, and a row being renamed is not draggable — a drag
started mid-edit would take the half-typed name with it.

The tree logic is a separate module with its own tests, because most of the
sharp edges are in it rather than in the rendering. An intermediate folder
is created even when nothing declared it, or a lone "Reports/Daily" leaves
its nesting invisible. A collapsed folder hides its descendants but stays
visible, or there is nothing left to click to reopen it. "Reports Archive"
is not inside "Reports" despite the prefix. A folder cannot be moved inside
itself or its own descendant, which would detach the subtree and lose it.

Drag-reordering within a folder is deliberately not built, and the
requirement now says so: favorites sort by recency, and a manual order would
be a second ordering to keep in step with no one asking for it.

Closes #334

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth merged commit 4183660 into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/favorites-nested-categories branch September 10, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1/doc-drift] FR-9.2.2 hierarchical folders and drag-drop reordering — categories are flat strings

1 participant