feat: "Most used" (frecency) sort for history - #253
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
paste_countcolumn (migrated) +idx_paste_countindex.database.buildOrderBy(sortMode)— pure, tested; threaded throughqueryHistoryItemsand 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.tscclean · 605 tests green.🤖 Generated with Claude Code