feat(desktop): place workspaces moved into a group at the top

PR
1mo ago
+7-48

What & why

Moving a workspace into a group put it at the bottom, so in a large group you
have to scroll to find what you just moved. It now goes to the top, using the
getPrependTabOrder() helper already sitting next to getNextTabOrder(). This
matches how new workspaces and projects already enter the sidebar.

Bulk moves needed the loops reversed. Prepend is relative to the group's current
lowest tab order, so each item lands above the previous one and a multi-select
walked top-to-bottom would land backwards.

The optional top/bottom preference from the issue is not included.

Fixes #5342

How I tested it

  • bun run lint clean; bun test on the sidebar dirs, 88 pass
  • bun run typecheck fails in @superset/ui
  • Dev app: a single move lands first in the group, and a ⌘-clicked
    multi-select keeps its order at the top.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs

Screen recording:

Before fix:

https://github.com/user-attachments/assets/c60b28a2-d773-402b-935f-b1808b664e9f

After fix:

https://github.com/user-attachments/assets/406b3f71-120a-4177-bb0b-2a7010c6c651


Summary by cubic

Moving a workspace into a group now puts it at the top; multi-select moves keep original order, including mixed selections and when creating a new group. Fixes #5342; no top/bottom preference.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed bulk workspace moves so selected workspaces retain their original order.
    • Moved workspaces now appear at the beginning of the destination section, consistently across existing and newly created sections.
    • Improved handling when moving workspaces that are already in the selected destination section.
    • Ensured workspace ordering remains consistent when moving multiple items at once.