Skip to content

Sort Modes & Reordering

Tasks, Lists, and Steps have a persisted custom order (drag-and-drop) and an optional temporary sort chosen from a menu. Sorting produces a view order; drag-and-drop sets the persisted fractional rank (Product Brief §5.2 “Drag-and-drop / ordering rules”).

src/lib/rank/sort-modes.tsrenderSortMode(items, mode) returns items in the chosen SortMode, using compareRanks for custom order. Per-scope modes (matching the scope sort policy):

  • Tasks: custom, alphabetical, due, created, importance.
  • Lists: custom, alphabetical, created.
  • Steps: custom, alphabetical, created.

Passing due/importance for Lists or Steps falls back to (rank, id) order. (Only the Tasks scope exposes the full sort dropdown; Lists and Steps reorder by drag-and-drop.)

src/lib/prefs/sort-mode-store.ts keeps the active mode per scope instance (ScopeInstanceKey): getSortMode(...), setSortMode(scopeKey, mode), subscribeSortMode(...), and defaultSortForView(view) for the default per built-in View. The store is observable so sort menus and lists re-render on change.

Custom order is the fractional rank (per-List for Tasks, per-Task for Steps, per-User for Lists/Groups). Sorting never mutates rank; it only reorders the view. See the Fractional Rank Algorithm.

Related: Fractional Rank Algorithm, My Day & Owner-Scoped Views, List Sidebar & Drag-Drop (deferred guide).