-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Summary
Add a pause/resume button to the transaction list toolbar that allows users to temporarily stop the automatic polling for new transactions. This lets users examine current data without it being refreshed every 10 seconds, which is useful when investigating specific transactions or comparing data.
Context
The transaction list page uses React Query with a 10-second refetchInterval to poll for new transactions. While this provides real-time visibility, it can be disruptive when a user needs to:
- Analyze a specific set of transactions without the list changing
- Compare transaction details side-by-side
- Read through transaction data without interruption
React Query's enabled option provides a clean mechanism to pause/resume polling without losing cached data.
Architecture
graph LR
A[PauseButton] -->|toggles| B[isPaused state]
B -->|controls| C[useTransactionsListQuery]
C -->|enabled=!isPaused| D[React Query refetchInterval]
D -->|when enabled| E[GET /api/transactions]
Key files:
harp_apps/dashboard/frontend/src/Domain/Transactions/useTransactionsListQuery.ts- Query hookharp_apps/dashboard/frontend/src/Pages/Transactions/TransactionListPage.tsx- Page componentharp_apps/dashboard/frontend/src/Pages/Transactions/Components/Buttons.tsx- Button components
Input
- User clicks pause button →
isPausedstate toggles totrue - User clicks play button →
isPausedstate toggles tofalse
Output and Testing Scenarios
Expected Output:
- Pause button appears in toolbar next to refresh button
- When paused: polling stops, button shows play icon
- When resumed: polling resumes at 10s interval, button shows pause icon
- Cached data remains visible while paused
Testing Scenarios:
- Happy Path: User clicks pause → polling stops → data remains visible → clicks play → polling resumes
- Page navigation: User pauses → navigates away → returns → state resets to unpaused (default)
- Manual refresh while paused: User can still use refresh button to manually fetch while paused
Possible Implementation
- Add
enabledparameter touseTransactionsListQueryhook - Add
isPausedstate inTransactionListPage - Create
PauseButtoncomponent inButtons.tsxwith play/pause icon toggle - Add button to toolbar alongside existing
RefreshButton
The implementation follows existing patterns in the codebase - useTransactionsDetailQuery already uses conditional enabled for reference.