Repository navigation
Description
Goal
The "Move to…" dialog lists the same group options as the other group pickers, so a group whose parent is missing no longer disappears from the list of move targets.
Context
Follow-up of #1684 (PR #1754): the review noticed that MoveToDialog builds its own list instead of using the shared helper.
apps/smart-ssh-community/frontend/src/components/MoveToDialog.tsx:20-34 defines a local flatten() and calls flatten(buildGroupTree(groups, servers, []).roots, 0, []). buildGroupTree drops groups whose parent group is missing (and cycles), so such groups cannot be chosen as a target. flattenGroupOptions in lib/groupTree.ts:93 returns the same depth-first order with depth, but keeps those groups at root level; GeneralTab.tsx and GroupForm.tsx already use it.
Requirements
- Replace the local
flattenand thebuildGroupTreecall inMoveToDialogwithflattenGroupOptions(groups); delete the localflattenand any import that becomes unused. - Orphaned groups (missing parent) appear at depth 0 as selectable targets. Decision: they are selectable, because every other group picker shows them and the drop validity check (
classifyDrop) still disables invalid targets. - Rendering, order, indentation, "current" marker and disabled states of the existing entries stay the same.
Acceptance Criteria
-
MoveToDialog.tsxhas no localflattenand does not callbuildGroupTree. - Existing groups appear in the same order and with the same depth as before.
- A group whose
parentIdpoints to a missing group is listed at depth 0 and can be chosen (unlessclassifyDropmarks it invalid). - A new test in
MoveToDialog.test.tsxcovers the orphan case and fails against the old code. - Relevant automated tests pass (
npx vitest run src/components/MoveToDialog.test.tsx src/lib/groupTree.test.ts,npx tsc -b,npm run lint)
Technical Notes
Frontend only. No backend or data change. Check that the servers prop is still needed by the component (it is used by classifyDrop).
Files: apps/smart-ssh-community/frontend/src/components/MoveToDialog.tsx, apps/smart-ssh-community/frontend/src/components/MoveToDialog.test.tsx
Spec impact: none
Open questions
- Should orphaned groups be hidden instead? Alternative: keep today's behaviour. Recommendation: show them (see Requirements), consistent with the other pickers.
Activity