Skip to content

feat(desktop): reorder sessions by dragging the session list - #3364

Open
czs914893385 wants to merge 1 commit into
GCWing:mainfrom
czs914893385:feat/session-manual-reorder
Open

czs914893385 wants to merge 1 commit into
GCWing:mainfrom
czs914893385:feat/session-manual-reorder

Conversation

@czs914893385

@czs914893385 czs914893385 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds manual ordering to the desktop session list: a new Manual session-view ordering mode and drag-and-drop reordering of the session rows in the left nav.

Why

The session list could only be sorted by updated / status / created / name, so sessions a user wants to keep together had no way to stay where the user put them. #3350 (merged) added the session-row menu action for copying a session; this uses the same surface, so a session row can now be copied or arranged by hand.

How

  • New pure module src/web-ui/src/flow_chat/utils/sessionManualOrder.ts (move inside the stored list, reconcile it against the sessions that exist, order a view from a stored list) with its own tests.
  • The existing session-view preference store gains a scope-keyed manualOrder map (workspace:<id> for one workspace group, all for the flat "all sessions" view) beside the existing ordering preference, persisted the same way. It is a local UI preference: corrupt or legacy values are normalized and never throw, and the persist version is not bumped.
  • Ordering is applied at the single existing sort point in SessionsSection.tsx; every other ordering mode keeps its current behaviour.
  • Drag uses native HTML5 drag events, the same pattern as the existing workspace drag reorder: custom MIME type, insertion side decided by the row's vertical midline, drop indicator, and the existing 160 ms FLIP settle that honours prefers-reduced-motion.
  • Dragging works only within one scope. A drop from another scope or sibling group is rejected before any state changes.
  • Committing a reorder switches the view to manual ordering, silently: dragging is a frequent gesture, so a notice per drop would be noise. The ordering control reflects the switch.
  • Rows that are loaded but not rendered cannot take part in a reorder, and the stored order keeps slots for sessions that are not loaded, so dragging can never reorder a row the user cannot see.
  • Sessions that disappear from the list are pruned from the stored order (only ids actually observed to vanish).

Limits

  • The order is local to the device: no host-side field, no protocol change, no cross-device or mobile sync.
  • Web UI only: no Rust changes and no new dependencies.

Testing

  • pnpm run lint:web - 0 errors (the 10 remaining warnings are pre-existing in unrelated files).
  • pnpm --dir src/web-ui run test:run - 972 files / 10760 tests pass, including the new sessionManualOrder.test.ts (17) and sessionRowManualReorder.test.tsx (17); the existing sessionRowContextMenu.test.ts (6) still passes.
  • pnpm run build:web - green: appearance contract audit, parallel type-check + vite build, frontend revision, monaco asset verification, WebKit compatibility gate.
  • node scripts/i18n-audit.mjs - clean.
  • Manually verified in a locally built desktop preview: a real mouse drag with the drop indicator, the resulting order change, the silent mode hand-off, and persistence across a restart.

i18n

nav.sessions.viewMenu.ordering.manual added to en-US / zh-CN / zh-TW.

中文说明

  • 会话列表新增「手动排序」模式,并支持在左侧列表里拖动会话行调整顺序。
  • 顺序按作用域记忆(每个工作区分组一份,扁平「全部会话」视图一份),存在本机的界面偏好里,重启后保留;旧的或损坏的存储值会被规整,不会抛错。
  • 拖动只在同一作用域内生效;跨分组拖动会被直接拒绝。
  • 落地一次拖动会静默切换到「手动排序」(拖动很频繁,因此不弹提示),排序控件会显示当前模式。
  • 已加载但未渲染(分页之外)的行不参与排序;存储顺序会保留未加载会话的位置,会话消失时只清理确实消失的 id。
  • 局限:顺序只存本机,不做跨设备/手机端同步;纯前端改动,无 Rust 与依赖变更。

@czs914893385

Copy link
Copy Markdown
Contributor Author

Closing this for now - I want to test the interaction locally before asking for review. Sorry for the noise.

@czs914893385 czs914893385 reopened this Oct 13, 2026
@czs914893385
czs914893385 force-pushed the feat/session-manual-reorder branch from 7d612c8 to 4d8f02e Compare October 13, 2026 06:03
@czs914893385

Copy link
Copy Markdown
Contributor Author

Reopening: the lint failure in the previous revision is fixed, and the row-menu Move up / Move down items were dropped at the reporter's request, so this is now drag-only plus the Manual ordering mode.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant