Skip to content

[Frontend] Borrower loans live under two disjoint query-key namespaces, so mutations/streams invalidate only one and leave the other stale #1219

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

useBorrowerLoans uses queryKeys.borrowerLoans.byAddress -> [borrowerLoans, addr] (useApi.ts:1187) while useBorrowerLoansPage uses queryKeys.loans.borrowerPage -> [loans,borrower,addr,params] (useApi.ts:1221). These are disjoint prefixes. useCreateLoan invalidates only [loans] (useApi.ts:870) -> hits borrowerPage but misses byAddress; useRepayLoan (useApi.ts:1557) and useLoanStream (useLoanStream.ts:43) invalidate only byAddress -> miss the paginated borrowerPage list. Result: after creating/repaying, one of the two borrower lists shows stale data until staleTime expires.

Acceptance criteria

  • Unify borrower-loan caching under a single key namespace, or have every borrower-loan mutation/stream invalidate both keys
  • useCreateLoan should also invalidate queryKeys.borrowerLoans.byAddress for the borrower
  • useRepayLoan/useLoanStream should also invalidate the borrowerPage key

Files to touch

  • frontend/src/app/hooks/useApi.ts
  • frontend/src/app/hooks/useLoanStream.ts

Out of scope

  • Pagination cursor design

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingfrontendIssues related to frontend development

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions