Commit 4e3d919
authored
feat: prefetch transaction list on tokens screen (#2137)
# Prefetch Transaction Data for Improved Activity Tab Performance
## What changed (plus any additional context for devs)
- Added a `prefetchInfiniteTransactionList` function that loads transaction data in the background
- Implemented prefetching on the Tokens/balances screen to give the ListTransactions API a head start before users navigate to the Activity tab
- The prefetch function checks if data already exists in the cache to avoid unnecessary API calls
- Added proper type imports and store access for the prefetch function to work outside React components
## What to test
- Navigate to the Tokens/balances screen and verify that transaction data is being prefetched
- Check that navigating to the Activity tab feels faster since data is already loading
- Verify that the prefetch function doesn't make duplicate API calls if data already exists
- Test with different wallet addresses to ensure prefetching works correctly for all accounts
- Confirm that the prefetch function properly handles testnet mode and enabled chain IDs
<!-- start pr-codex -->
---
## PR-Codex overview
This PR introduces a new feature to prefetch transaction data for a user's address when they are on the tokens/balances screen, enhancing performance by loading data in advance.
### Detailed summary
- Added `prefetchInfiniteTransactionList` function to prefetch transactions based on the user's address.
- Implemented `useEffect` in the `Tokens` component to call the prefetch function when `currentAddress` changes.
- Enhanced error handling and caching logic in the prefetch function.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->1 parent 6c2f403 commit 4e3d919
2 files changed
Lines changed: 67 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | | - | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
36 | 93 | | |
37 | 94 | | |
38 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
162 | 171 | | |
163 | 172 | | |
164 | 173 | | |
| |||
0 commit comments