Skip to content

[Bug]: v0.0.16 regression: drag-and-drop project reordering silently fails when sort is set to Manual #1902

@mwolson

Description

@mwolson

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Add two or more projects that have git remotes (origin, upstream, etc.)
  2. In the sidebar, open the project sort dropdown and select "Manual"
  3. Try to drag a project to a different position in the sidebar

Expected behavior

The dragged project moves to the new position and the reordered list persists across sessions.

Actual behavior

The drag animation plays but the project snaps back to its original position. The order never changes. This is a regression introduced in v0.0.16; drag-and-drop reordering worked in v0.0.15.

Switching to "Manual" also does not preserve the order that was visible under the previous sort mode (e.g. "Last updated"); it reverts to whatever order was last stored in projectOrder.

Impact

Minor bug or occasional failure

Version or commit

v0.0.16 (a3dadf3)

Environment

Linux (CachyOS), desktop app

Logs or stack traces

No errors in ~/.t3/userdata/logs/. The failure is silent.

Workaround

None found. Projects without git remotes are unaffected because their logical key falls back to the physical key.

Analysis and fix plan

Commit b7559c4 (#1768) changed sidebarProjects to group projects by logical key (from deriveLogicalProjectKey, which returns repositoryIdentity.canonicalKey for projects with git remotes, e.g. github.com/owner/repo). The drag-end handler at Sidebar.tsx:2699 passes these logical keys to reorderProjects() in uiStateStore.ts, but state.projectOrder still stores physical keys (local:<uuid>). The findIndex calls at lines 491-492 return -1 and the function returns state unchanged.

The fix is small: reorderProjects needs to operate on the same key space used by the sidebar. One approach is to have the drag handler resolve logical keys back to physical keys before calling reorderProjects; another is to migrate projectOrder to use logical keys. The first option is more contained.

I'm planning to open a small PR for this shortly in the hope that it's useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions