Skip to content

feat: "Most used" (frecency) sort for history - #253

Merged
omercelikdev merged 1 commit into
mainfrom
feat/frecency-sort
Jul 12, 2026
Merged

feat: "Most used" (frecency) sort for history#253
omercelikdev merged 1 commit into
mainfrom
feat/frecency-sort

Conversation

@omercelikdev

Copy link
Copy Markdown
Owner

Third "wow" feature: a sort toggle in the history filter bar flips between Recent (chronological, default) and Most used.

"Most used" orders by paste count with recency as the tiebreaker — a simple, predictable frecency — while pinned clips still lead in both modes. The choice persists (qlip_historySortMode).

How

  • DBpaste_count column (migrated) + idx_paste_count index.
  • database.buildOrderBy(sortMode) — pure, tested; threaded through queryHistoryItems and the store's load / refresh / loadMore.
  • historyStore.recordPaste(id) — bumps the count, fired from every real paste (row click + keyboard select), never from a diff selection.
  • appStore.historySortMode (persisted) drives the query.

Default stays chronological so nothing reorders unexpectedly — frecency is opt-in via the toggle.

Tests

buildOrderBy — default / recent / frequent, and the pinned-first invariant. tsc clean · 605 tests green.

"Wow" series: #251 calculator, #252 smart actions, this. Next: unified search.

🤖 Generated with Claude Code

A sort toggle in the history filter bar flips between Recent (chronological,
the default) and Most used. "Most used" orders by paste count with recency
as the tiebreaker — a simple, predictable frecency — while pinned clips
still lead in both modes. The choice persists (qlip_historySortMode).

- DB: paste_count column (migrated) + idx_paste_count index.
- database.buildOrderBy(sortMode) — pure, tested; threaded through
  queryHistoryItems and the store's load/refresh/loadMore.
- historyStore.recordPaste(id) bumps the count, fired from every real paste
  (row click + keyboard select), never from diff selection.
- appStore.historySortMode (persisted) drives the query.

Default stays chronological so nothing reorders unexpectedly — the frecency
view is opt-in per the toggle.

Tests: buildOrderBy (default/recent/frequent, pinned-first invariant).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omercelikdev
omercelikdev merged commit 72cdd61 into main Jul 12, 2026
@omercelikdev
omercelikdev deleted the feat/frecency-sort branch July 12, 2026 18:48
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