How to handle cancellation and timeouts in FilamentPHP Livewire actions?
0 reputation · 11 Nov 2024, 20:20 UTC
When a FilamentPHP Livewire component initiates a long‑running operation, I need the UI to stay responsive, show a loading indicator, and allow the user to cancel the operation while also guaranteeing that the process does not exceed a predefined maximum execution time. The component must clean up any background workers or queued jobs when cancellation or timeout occurs and report the final state (success, cancelled, timed‑out) back to the Filament view without leaving stale state.
How can I bind a cancellation button in the Livewire component to signal a running job to stop? What is a reliable way to enforce a hard timeout on the job or process from within FilamentPHP/Livewire? How should the component surface the outcome (success, cancelled, timed‑out) to the view and reset any loading state?