Pause Polling in Background Tabs in Inertia.js v3.9
Inertia.js v3.9 brings automatic background tab polling throttling to save client battery and slash unnecessary server requests.
Pause Polling in Background Tabs in Inertia.js v3.9
Real-time dashboards frequently use periodic polling to refresh live stats, notifications, or task execution progress. However, when users leave a tab open in the background, polling can waste server bandwidth and drain mobile battery life.
Automatic Page Visibility Detection
Inertia.js v3.9 hooks into the browser Page Visibility API to automatically pause or intelligently back off active poll requests when a user minimizes or switches away from the window:
// In your Vue or React component
usePoll(3000, {
autoPause: true, // Pauses when tab is inactive
keepAlive: false,
});
When the user returns to the tab, Inertia immediately fires a refresh request to catch up with latest state seamlessly.