fix: invalidate invoice queries after marking as paid#569
Conversation
- Add byWorkspace query invalidation to markPaid mutation - Add byWorkspace query invalidation to send mutation - Add stats query invalidation to all invoice mutations - Also update delete mutation to invalidate stats This ensures the invoice list and stats update immediately without requiring a page refresh Fixes #533 Co-authored-by: adambarito <adambarito@users.noreply.github.com>
Greptile SummaryThis PR fixes a stale-UI bug where marking an invoice as paid (or sending it) would not update the invoice list or stats counters without a full page refresh. It does so by adding Key changes:
Minor gap: The Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant IC as InvoiceDetail
participant tRPC as tRPC Server
participant QC as QueryClient Cache
U->>IC: Click "Mark as Paid" / "Send Invoice"
IC->>tRPC: mutate(markPaid / send)
tRPC-->>IC: onSuccess → show toast
IC->>QC: onSettled: Promise.all([invalidate byId, byWorkspace, stats])
QC-->>IC: refetch byId (invoice detail updates)
QC-->>IC: refetch byWorkspace (invoice list updates)
QC-->>IC: refetch stats (dashboard counters update)
U->>IC: Click "Delete"
IC->>tRPC: mutate(delete)
tRPC-->>IC: onSuccess → toast + router.push(invoice list)
IC->>QC: onSettled: Promise.all([invalidate byWorkspace, stats])
QC-->>IC: refetch byWorkspace (deleted item removed from list)
QC-->>IC: refetch stats (counters updated)
|
apps
db
|
Fixes #533
Description
This PR fixes the issue where marking an invoice as paid doesn't update its status on the invoice page or the all-invoices page without requiring a page refresh.
Changes
This ensures the invoice list and stats update immediately without requiring a page refresh.
Generated with Claude Code