Skip to content

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

Open
prayagtushar wants to merge 1 commit into
ParadevAI:mainfrom
prayagtushar:feat/move-to-group-top
Open

prayagtushar wants to merge 1 commit into
ParadevAI:mainfrom
prayagtushar:feat/move-to-group-top

Conversation

@prayagtushar

@prayagtushar prayagtushar commented Aug 3, 2026 •

Copy link
Copy Markdown

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:

Screen.Recording.2026-08-03.at.7.01.23.PM.mov

After fix:

Screen.Recording.2026-08-03.at.6.59.30.PM.mov

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.

Written for commit 6210bb0. Summary will update on new commits.

Review in cubic

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.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Workspace moves now place items at the top of the target section. Bulk moves reverse selected workspace IDs before insertion to preserve selection order.

Changes

Sidebar workspace ordering

Layer / File(s) Summary
Prepend workspace moves and preserve bulk order
apps/desktop/src/renderer/routes/_authenticated/hooks/useDashboardSidebarState/useDashboardSidebarState.ts, apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useBulkWorkspaceMoveActions/useBulkWorkspaceMoveActions.ts
moveWorkspaceToSection now prepends moved workspaces. Bulk section moves and new-group creation reverse selected workspace IDs before moving them. The unused helper import is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes place moved workspaces at the top of groups and preserve bulk-selection order, satisfying issue #5342; configurable placement is optional.
Out of Scope Changes check ✅ Passed All code changes support top placement or correct bulk-move ordering, and no unrelated changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly describes the primary change and follows the required conventional commit format.
Description check ✅ Passed The description includes the required sections, explains the change, references the issue, documents testing, and provides recordings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes workspace moves into sidebar groups to prepend workspaces rather than append them, and reverses bulk iteration to retain visual order.

  • Uses getPrependTabOrder when assigning a moved workspace to a section.
  • Processes bulk group moves and group creation from bottom to top.
  • Mixed selections containing existing target-group members can still be reordered incorrectly.

Confidence Score: 4/5

The mixed-selection ordering defect should be fixed before merging because moving a selection into a group can visibly reverse part of that selection.

Filtering out selected workspaces already in the target section before reversing and prepending the remainder cannot preserve relative visual order across the complete selection.

Files Needing Attention: apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useBulkWorkspaceMoveActions/useBulkWorkspaceMoveActions.ts

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useBulkWorkspaceMoveActions/useBulkWorkspaceMoveActions.ts Reverses bulk move iteration correctly for wholly incoming selections, but mixed selections with existing target-section members do not retain their full visual order.
apps/desktop/src/renderer/routes/_authenticated/hooks/useDashboardSidebarState/useDashboardSidebarState.ts Changes section moves from append to prepend using the existing tab-order helper; the assignment itself is consistent with the requested behavior.

Sequence Diagram

sequenceDiagram
    participant User
    participant Bulk as Bulk move action
    participant Filter as workspaceIdsForSectionMove
    participant State as Sidebar state
    User->>Bulk: Move visually ordered selection to group
    Bulk->>Filter: Filter selection for target group
    Filter-->>Bulk: Exclude members already in target
    Bulk->>Bulk: Reverse remaining IDs
    loop Each remaining workspace
        Bulk->>State: Move and prepend
    end
    Note over State: Incoming items precede existing selected target members
Loading
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useBulkWorkspaceMoveActions/useBulkWorkspaceMoveActions.ts:63-67
**Mixed selection order breaks**

When a selection includes workspaces already in the target section, `workspaceIdsForSectionMove` removes those IDs before this loop reverses and prepends the remainder, causing incoming workspaces to appear ahead of selected target-section workspaces that originally preceded them.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(desktop): place workspaces moved in..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Architecture diagram
sequenceDiagram
    participant UI as Desktop UI
    participant Hook as useBulkWorkspaceMoveActions
    participant SectionHook as useDashboardSidebarState
    participant LocalState as v2WorkspaceLocalState (collections)

    Note over UI,LocalState: Workspace movement into a group

    UI->>Hook: Trigger move (single or bulk)
    alt Single workspace move
        UI->>SectionHook: moveWorkspaceToSection(workspaceId, projectId, sectionId)
        SectionHook->>SectionHook: CHANGED: getPrependTabOrder(siblingRows) instead of getNextTabOrder
        SectionHook->>LocalState: update(workspaceId, { tabOrder: prependedOrder, ... })
        LocalState-->>SectionHook: Updated
        SectionHook-->>UI: Workspace lands at top of group
    else Bulk workspace move (moveSelectionToSection)
        UI->>Hook: moveSelectionToSection(sectionId)
        Hook->>Hook: CHANGED: Reverse selection order (bottom-to-top iteration)
        loop For each workspaceId in reversed selection
            Hook->>SectionHook: moveWorkspaceToSection(workspaceId, projectId, sectionId)
            SectionHook->>SectionHook: getPrependTabOrder(siblingRows)
            SectionHook->>LocalState: update(workspaceId, { tabOrder, ... })
            LocalState-->>SectionHook: Updated
        end
        Hook->>Hook: clearSelection()
        Note over UI,LocalState: Result: original order preserved, items at top of group
    else Bulk create group (createGroupFromSelection)
        UI->>Hook: createGroupFromSelection()
        Hook->>SectionHook: createSection(projectId)
        SectionHook-->>Hook: sectionId
        Hook->>Hook: CHANGED: Reverse selectedIds iteration (bottom-to-top)
        loop For each workspaceId in reversed selectedIds
            Hook->>SectionHook: moveWorkspaceToSection(workspaceId, projectId, sectionId)
            SectionHook->>SectionHook: getPrependTabOrder(siblingRows)
            SectionHook->>LocalState: update(workspaceId, { tabOrder, ... })
            LocalState-->>SectionHook: Updated
        end
        Hook->>Hook: clearSelection()
    end
Loading

Re-trigger cubic

@prayagtushar
prayagtushar force-pushed the feat/move-to-group-top branch from 53a15ad to 6210bb0 Compare August 5, 2026 13:49
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 53 days and will close in 7 days unless there is new activity. If this contribution is still important or relevant, please leave a comment to keep it open. If it closes, you are welcome to reopen it or ask a maintainer to reopen it. Thank you for contributing!

@github-actions github-actions Bot added the stale label Sep 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] "Move to group" should place the workspace at the top of the group, not the bottom

1 participant