Poll an export job until ready
Coordinate a resumable export-job polling lifecycle with explicit pause and cancellation controls.Description
Requirements
Export an ExportJobPoller component from src/App.tsx.
Invoke startExport once for a polling lifecycle and retain the returned job ID.
Never allow two getStatus requests for the same job to overlap.
Pause cancels the scheduled poll and prevents another status request.
Resume continues polling the existing job instead of starting a replacement job.
A ready status stops polling and exposes an accessible download link.
Cancel stops scheduled and in-flight work and invokes cancelExport for the active job once.
Unmounting cancels the scheduler and aborts any active start or status request.
Pause and resume
Pause while job exp-7 is processing, then Resume
No polls run while paused and polling resumes for exp-7
Resuming must not create a second export.
Ready result
A status poll returns ready with /exports/exp-7.csv
Polling stops and a Download export link appears
Terminal states clear scheduled work.
Constraints
Use scheduler.schedule rather than global timersPoll only non-terminal jobsKeep pause distinct from cancellation
Hints
Hint 1
Store the job ID independently from the current polling state.
Hint 2
Schedule the next poll only after the current request settles.
Hint 3
Route pause, ready, cancel, and unmount through one cleanup function.