refactor(categories) : unifier la machine a etats des 2 arbres de categories sur useCollapsibleGroups #294

Open
maximus wants to merge 1 commit from issue-290-categories-unify into issue-289-budget-collapse
Owner

Resolves #290

Stacked on #293 (issue-289-budget-collapse) — base branch is issue-289-budget-collapse, not main. Review/merge #293 first.

Unifies the collapse state machine of the two category trees onto useCollapsibleGroups (a strict superset after #288), keeping each tree's distinct recursive render and CategoryTree's drag-and-drop untouched.

  • CategoryTree (Categories page) → hook with storageKey: null + defaultExpanded: true (expanded by default, no seeding); drops the local Set + collectExpandable.
  • CategoryTaxonomyTree + guide page → hook with storageKey: null + defaultExpanded: false (collapsed by default); shared TAXONOMY_COLLAPSE_ACCESSORS exported from the tree.
  • Fixes the guide button bug (allExpanded = expanded.size > 0 flipped after one node → hook's correct allExpanded), and migrates a 4th consumer (StepDiscover, same bug) onto the hook for a green build + consistency.

Behaviours preserved: Categories opens expanded (DnD intact), guide/wizard open collapsed, and opening one node no longer flips the button.

Build 0 TS errors · 828 vitest pass · cargo check clean. No DB migration.

Generated autonomously by /autopilot run of 2026-07-15

Resolves #290 **Stacked on #293** (`issue-289-budget-collapse`) — base branch is `issue-289-budget-collapse`, not `main`. Review/merge #293 first. Unifies the collapse **state machine** of the two category trees onto `useCollapsibleGroups` (a strict superset after #288), keeping each tree's distinct recursive render and CategoryTree's drag-and-drop untouched. - **CategoryTree** (Categories page) → hook with `storageKey: null` + `defaultExpanded: true` (expanded by default, no seeding); drops the local `Set` + `collectExpandable`. - **CategoryTaxonomyTree + guide page** → hook with `storageKey: null` + `defaultExpanded: false` (collapsed by default); shared `TAXONOMY_COLLAPSE_ACCESSORS` exported from the tree. - Fixes the guide button bug (`allExpanded = expanded.size > 0` flipped after one node → hook's correct `allExpanded`), and migrates a 4th consumer (`StepDiscover`, same bug) onto the hook for a green build + consistency. Behaviours preserved: Categories opens expanded (DnD intact), guide/wizard open collapsed, and opening one node no longer flips the button. Build 0 TS errors · **828 vitest pass** · cargo check clean. No DB migration. Generated autonomously by /autopilot run of 2026-07-15
maximus added 1 commit 2026-07-16 01:30:44 +00:00
Replace the two hand-rolled Set-of-ids collapse state machines in the category
trees with the shared useCollapsibleGroups hook (a strict superset after #288),
keeping each tree's distinct recursive render and CategoryTree's drag-and-drop
untouched.

- CategoryTree (Categories page): storageKey null + defaultExpanded true, so
  every parent opens with no seeding; drops the local Set + collectExpandable.
- CategoryTaxonomyTree + guide page: storageKey null + defaultExpanded false
  (collapsed by default); exports a shared TAXONOMY_COLLAPSE_ACCESSORS.
- Fix the guide's button bug: allExpanded = expanded.size > 0 flipped to
  "Collapse all" after opening a single node; now uses the hook's correct
  allExpanded (every group must be open).
- Also migrate StepDiscover (4th consumer of CategoryTaxonomyTree, same button
  bug) onto the hook for a green build and consistency.

Both trees pass a flattened node list to the bulk ops; behaviour preserved:
Categories opens expanded, the guide/wizard open collapsed.

Resolves #290

Generated autonomously by /autopilot run of 2026-07-15

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maximus added the
autopilot:pending-human
label 2026-07-16 01:31:17 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-290-categories-unify:issue-290-categories-unify
git checkout issue-290-categories-unify

Merge

Merge the changes and update on Forgejo.
git checkout issue-289-budget-collapse
git merge --no-ff issue-290-categories-unify
git checkout issue-289-budget-collapse
git merge --ff-only issue-290-categories-unify
git checkout issue-290-categories-unify
git rebase issue-289-budget-collapse
git checkout issue-289-budget-collapse
git merge --no-ff issue-290-categories-unify
git checkout issue-289-budget-collapse
git merge --squash issue-290-categories-unify
git checkout issue-289-budget-collapse
git merge --ff-only issue-290-categories-unify
git checkout issue-289-budget-collapse
git merge issue-290-categories-unify
git push origin issue-289-budget-collapse
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: maximus/Simpl-Resultat#294
No description provided.