Skip to content

Unify borrower-loan cache namespaces and implement real repayment flow#1283

Open
wheval wants to merge 1 commit into
LabsCrypt:mainfrom
wheval:fix/borrower-loans-cache-repayment-impl
Open

Unify borrower-loan cache namespaces and implement real repayment flow#1283
wheval wants to merge 1 commit into
LabsCrypt:mainfrom
wheval:fix/borrower-loans-cache-repayment-impl

Conversation

@wheval

@wheval wheval commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Test plan

  • Create a loan -> verify both useBorrowerLoans and useBorrowerLoansPage refetch
  • Repay a loan -> verify both borrower loan lists and pool stats refresh
  • Trigger a LoanRepaid SSE event -> verify borrowerPagePrefix is also invalidated
  • Call executeRepayment -> verify txHash in result is a real server-returned hash, not tx_Date.now()

Closes #1219
Closes #1220

…epayment flow

- queryKeys.loans: add borrowerPagePrefix(address) helper for prefix-based
  invalidation that matches all paginated borrower-loan entries regardless of
  cursor/limit params (LabsCrypt#1219)
- useCreateLoan.onSuccess: also invalidate queryKeys.borrowerLoans.byAddress
  for the authenticated wallet so both borrower-loan lists refresh after a new
  loan is created (LabsCrypt#1219)
- useRepayLoan.onSettled: also invalidate queryKeys.loans.borrowerPagePrefix so
  the paginated borrower list refreshes alongside the byAddress list (LabsCrypt#1219)
- useLoanStream.invalidateLoanQueries: also invalidate borrowerPagePrefix on
  real-time loan events so SSE-driven refreshes hit both namespaces (LabsCrypt#1219)
- useRepaymentOperation.executeRepayment: replace setTimeout-based simulation
  (fake txHash, no on-chain effect) with a real call to useRepayLoan.mutateAsync,
  which submits the repayment and returns an actual txHash. XP/streak rewards
  and UI completion now only fire after the server confirms success (LabsCrypt#1220)

Closes LabsCrypt#1219
Closes LabsCrypt#1220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant