Why polling?
When users interact with Elements, the loan progresses through various stages. To keep your application in sync with these changes, you need to poll the GraphQL API to detect:- Loan application completion
- Stage transitions (e.g., from “Processing” to “Underwriting”)
- Task assignments and completions
- Document uploads
- Pre-approval status
Recommended polling intervals
| What to monitor | Recommended interval | Detection method |
|---|---|---|
| Loan stage | 15-30 minutes | Compare currentStage |
| Tasks | 15-30 minutes | Track task IDs and status |
| Application completion | 15-30 minutes | Check submitted field |
| Pre-approval status | 15-30 minutes | Check preApprovalStatus |
Basic polling implementation
Here’s a simple example that polls for loan application completion:Detecting stage changes
To detect when a loan moves to a new stage:Monitoring tasks
Poll for new tasks that borrowers need to complete:Complete polling guide
For comprehensive polling patterns, implementation examples, and best practices, see the Tracking loan updates guide. That guide covers:- Focused queries for efficient polling
- State management and change detection
- Error handling and retry logic
- Polling multiple loans
- Monitoring different entity types (stages, tasks, documents, etc.)
Best practices
- Use focused queries - Only request the fields you need to detect changes
- Store previous state - Cache values you’re monitoring to detect changes
- Handle errors gracefully - Implement retry logic for transient failures
- Adjust intervals - Poll more frequently for active loans, less for inactive ones
- Stop polling when done - Clear intervals when loans are complete or no longer need monitoring
Next steps
- Tracking loan updates - Complete polling guide with examples
- Customize the theme - Style the Element
- Borrower Dashboard Element - For managing completed applications