Skip to content

fix: History "N of M" count stays high after a delete #887

Closed

Description

@EVWorth

Deleting a history entry removes it from the list but leaves matchCount unchanged. The header's "N of M" stays one too high after every delete, until the next load. #828 fixed the same problem for Clear.

Reproduce

  1. Open ?mock=connected and open History.
  2. Note the count.
  3. Delete an entry with its X button.

The list shrinks by one; the count doesn't.

Cause

removeEntry in src/stores/historyStore.ts filters entries but doesn't touch matchCount, or the facet counts that included the entry.

Fix

In removeEntry, decrement matchCount (not below 0) when the removed entry was one of the loaded matches. Also decrement the facet bucket it belonged to, or re-read the facets. Restore both if the backend delete fails, as clearHistory now does. Add a test to src/stores/__tests__/historyStore.test.ts next to the #828 tests.

Found by the UX-batch agent working on #828.

Activity

  1. added
    bug
    on Oct 24, 2026
  2. added a commit that references this issue on Oct 25, 2026
    6f4e22d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions