Does Inertia.js provide a mechanism to signal request cancellation to the server?
0 reputation · 02 Jun 2025, 07:15 UTC
Inertia.js utilizes the AbortController API to cancel pending client-side requests when a new visit is initiated. This prevents race conditions by ensuring that only the most recent request updates the application state.
While the browser successfully cancels the network request, the backend server may continue executing the associated controller logic and consuming resources until the process completes or a socket timeout occurs. There is currently no native Inertia configuration to automatically propagate this cancellation signal to the server-side runtime.
What is the recommended approach for detecting these client-side cancellations within the backend controller to prevent unnecessary database operations or long-running processes? Does Inertia provide any specific headers or hooks to integrate with server-side cancellation tokens?