Skip to content

markAllRead doesn't update per-subscription unread counts in sidebar collections #624

@brendanlong

Description

@brendanlong

Problem

After markAllRead, the success handler in src/lib/hooks/useEntryMutations.ts:370-384:

  1. Invalidates utils.subscriptions.list (React Query cache)
  2. Invalidates utils.entries.list (React Query cache)
  3. Refetches tags collection
  4. Calls refreshGlobalCounts() for "all"/"starred"/"saved" counts

However, per-tag subscription collections (TagSubscriptionsCollection instances in the sidebar) are backed by separate query keys (["subscriptions-tag", filterKey]), which are NOT invalidated by utils.subscriptions.list.invalidate(). This means individual subscription unread counts in the sidebar remain stale until the user collapses and re-expands the tag section.

Fix

After markAllRead, also reset subscription unread counts in the global subscriptions collection (set all to 0 when markAllRead has no filter, or set filtered subscriptions to 0). Additionally, either invalidate the per-tag subscription collection queries or directly update the subscription objects in the per-tag collections.

Related to #580 (tanstack-db branch).

-- Claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions