Skip to content

feat: Add TanStack Query for cached data fetching#436

Open
RomThpt wants to merge 1 commit intoGemWallet:masterfrom
XRPL-Commons:pr/tanstack-query-setup
Open

feat: Add TanStack Query for cached data fetching#436
RomThpt wants to merge 1 commit intoGemWallet:masterfrom
XRPL-Commons:pr/tanstack-query-setup

Conversation

@RomThpt
Copy link

@RomThpt RomThpt commented Jan 12, 2026

Summary

  • Add @tanstack/react-query dependency for efficient data caching
  • Create QueryContext with QueryClientProvider and sensible defaults for wallet extension
  • Add useAccountBalances hook for cached balance fetching with 30s stale time
  • Refactor TokenListing to use the new cached hook, improving UX on page navigations
  • Update TokenListing tests to work with QueryClient

This PR introduces TanStack Query to improve data fetching performance by caching account balance data. Users will no longer see loading spinners when navigating between pages if data was recently fetched.

Test plan

  • All existing TokenListing tests pass
  • TypeScript compilation passes
  • Manual testing: Navigate between Home and other pages, verify balances don't reload unnecessarily
  • Manual testing: Fund wallet on testnet, verify balances update after funding

Add TanStack Query (React Query) to improve data fetching performance
and user experience by caching account balance data across page
navigations.

Changes:
- Add @tanstack/react-query dependency
- Create QueryContext with QueryClientProvider and sensible defaults
- Add useAccountBalances hook for cached balance fetching
- Refactor TokenListing to use the new cached hook
- Update TokenListing tests to work with QueryClient
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.

1 participant