Filament v3 Custom (AI and OCR) Processing Upload form Component - Worker Processing State Issue
What I am trying to do:
Create a universal file upload component in Filament v3 that processes files asynchronously using a worker queue, worker starts ocr processing using packages for jpg,xlsx,pdf, etc. for maintenance document uploads.
What I did:
Implemented a custom UniversalUploadComponent in Livewire
Created a WorkDocumentProcessor to handle document processing
Set up a relation manager for vehicle maintenance with file upload capabilities
Configured Filament form to use the custom upload component
Run worker with php artisan worker:work --workerId=1
My issue/the error:
After uploading a file and processing it through the worker queue:
The worker successfully processes the file
The file status changes to "processed" in the database
BUT the Filament UI remains stuck in "Uploading files..." state
The UI doesn't automatically update or reset after worker completes processing, preventing further interactions.
Code Snippets:
MaintenanceRelationManager form:
Section::make(('Documents'))
->schema([
BulkFileUpload::make('maintenance_documents')
->label((''))
->helperText(__(''))
->uploadDisk('public')
->uploadDirectory('maintenance_documents')
->maxFileSize(10240) // 10MB
->maxFiles(1)
->acceptedFileTypes([
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'image/jpeg',
'image/png',
'image/webp',
])
])
->processorClass('App\Http\Controllers\WorkDocumentProcessor')
...

4 Replies
I would probably put a watch for new record event and then send that off to my worker and then have the worker update the record status, like for processed/etc... I think your process is probably taking just long enough that the HTTP request probably never finishes in time to send back the Livewire notice and just leaves it hanging? Can you drop the processor and move it to be an event listener trigger?
Is it possible that the bug is happening because i added - when i upload the file from browse files, it automatically goes in to queue(skipping filament upload button) and when i press upload it goes to worker

to make things worse i have set maxfiles to 1 and i can upload 2 because of it

The Problem was that i used live() method in my form for my custom Upload form. With live(), as soon as a file was selected through Browse files, it immediately triggered a Livewire update and started processing - completely bypassing my upload button. I don't know if i misunderstood in documentation what it does or is it a bug. Now everything is working fine.