Skip to content

done#207

Merged
Junirezz merged 2 commits intoJunirezz:mainfrom
samad13:feature/optimistic-UI
Mar 30, 2026
Merged

done#207
Junirezz merged 2 commits intoJunirezz:mainfrom
samad13:feature/optimistic-UI

Conversation

@samad13
Copy link
Copy Markdown
Contributor

@samad13 samad13 commented Mar 28, 2026

I have successfully implemented optimistic UI updates for the deposit and withdrawal mutations in the frontend. This makes the application feel significantly faster by updating the UI state immediately while the transaction processes in the background.

Summary of Changes

  • Optimistic Mutations : Updated useVaultMutations.ts to include onMutate , onError , and onSettled handlers for both useDepositMutation and useWithdrawMutation .
    • Immediate Feedback : The USDC balance and portfolio holdings (specifically for the yvUSDC asset) are now updated optimistically as soon as a transaction is initiated.
    • Rollback Mechanism : If a transaction fails, the UI automatically rolls back to the previous stable state using a snapshotted cache.
    • Consistency : The onSettled handler ensures that all relevant queries (balance, holdings, vault summary, and transaction list) are invalidated to fetch the latest source-of-truth from the API.
  • Enhanced Reliability : Updated App.tsx to use the useUsdcBalance hook. This ensures that the global balance state is directly synchronized with the React Query cache, allowing optimistic updates to propagate throughout the entire application instantly.
  • Clean Component Logic : Refactored VaultDashboard.tsx to use the new mutation hooks. I removed the previous manual setTimeout simulation and local state hacks, replacing them with a robust, production-ready mutation flow.

close #131

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@samad13 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Junirezz Junirezz merged commit bc37d0d into Junirezz:main Mar 30, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontend: Add optimistic UI for simple mutations

2 participants