Simpl-Resultat/src/components/shared
le king fu 871768593d
All checks were successful
PR Check / rust (push) Successful in 22m7s
PR Check / frontend (push) Successful in 2m19s
PR Check / rust (pull_request) Successful in 21m37s
PR Check / frontend (pull_request) Successful in 2m14s
fix(reports): render category combobox in hierarchical DFS order (#126)
The by-category report combobox (`/reports/category`) was showing its full
category list with scrambled indentation — parents from one sub-tree
interleaved with children from another. Root cause: `getAllCategoriesWithCounts`
returns rows via `ORDER BY sort_order, name`, which is a *global* sort; two
different roots with sort_order=1 would be followed by their respective
children in the same bucket, mixing depths together.

Add a pure `sortHierarchical(categories, resolveName)` helper in
`CategoryCombobox.tsx` that rebuilds the display order as a DFS walk of the
tree: each parent is emitted immediately followed by its descendants, with
siblings within a group sorted by `sort_order` then localized display name.
Orphans (parent filtered out or missing) are appended at the end so nothing
disappears. The helper runs client-side inside the combobox's `useMemo`, so
the fix is scoped to this component and doesn't affect other consumers of
`getAllCategoriesWithCounts`. Filtering on the input query remains unchanged.

Covered by 7 unit tests on the helper (empty list, single root, the exact
bug-reproducing scrambled case, sort_order + name tiebreak, 3-level
hierarchy, orphans, idempotence).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 20:58:53 -04:00
..
CategoryCombobox.test.ts fix(reports): render category combobox in hierarchical DFS order (#126) 2026-04-21 20:58:53 -04:00
CategoryCombobox.tsx fix(reports): render category combobox in hierarchical DFS order (#126) 2026-04-21 20:58:53 -04:00
ChartContextMenu.tsx refactor: remove pivot report, add sub-route skeletons and shared components (#69) 2026-04-14 14:25:38 -04:00
ContextMenu.tsx refactor: remove pivot report, add sub-route skeletons and shared components (#69) 2026-04-14 14:25:38 -04:00
ErrorBoundary.tsx Add error boundary, error page, and startup timeout 2026-02-28 19:01:39 -05:00
ErrorPage.tsx feat: gate auto-updates behind license entitlement (#48) 2026-04-09 15:52:59 -04:00
PageHelp.tsx feat: add per-page contextual help via CircleHelp icon 2026-02-11 12:17:28 +00:00
TransactionDetailModal.tsx Add sort and amount toggle to report details, sticky budget headers 2026-03-01 09:31:47 -05:00