Skip to content

Move-to dialog: use the shared group option list so orphaned groups stay selectable #1775

Backlog

Description

@smart-ssh-planner

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 flatten and the buildGroupTree call in MoveToDialog with flattenGroupOptions(groups); delete the local flatten and 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.tsx has no local flatten and does not call buildGroupTree.
  • Existing groups appear in the same order and with the same depth as before.
  • A group whose parentId points to a missing group is listed at depth 0 and can be chosen (unless classifyDrop marks it invalid).
  • A new test in MoveToDialog.test.tsx covers 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.

Related Work

Activity

  1. added
    frontend
    follow-up
    on Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upfrontend

    Type

    Fields

    Priority

    P3 - Low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions