F
Filamentβ€’2mo ago
Michal

Production-only problem with FileUpload - on first upload the state is reset

Hey there! FileUpload triggers one more update livewire request after successfull upload and resets the state to empty. (checkout provided video) Valid upload (local): Upload process triggers two update requests and one upload-file. Invalid upload (production): Upload process triggers THREE (check out screenshot) requests with the last request reseting the state. Note: Yeah, it is the same code deployed on production as locally. Double checked. Can anyone try to explain please why is there this one more update trigger?
FileUpload::make("file")
->preserveFilenames()
->disk("local")
->directory("/temp")
->columnSpan(12)
FileUpload::make("file")
->preserveFilenames()
->disk("local")
->directory("/temp")
->columnSpan(12)
Interesting thing is that this happens only on production deployment. Locally it works perfectly fine.
No description
Solution:
It sounds like the delployed code ins't mounting the form first for some reason... usually $this->form->fill() on mount
Jump to solution
12 Replies
Solution
toeknee
toekneeβ€’2mo ago
It sounds like the delployed code ins't mounting the form first for some reason... usually $this->form->fill() on mount
Michal
MichalOPβ€’2mo ago
Funny, thanks @toeknee, the $this->form->fill() was the last line in mount. When i moved it to be first, it works now! thx.
toeknee
toekneeβ€’2mo ago
Welcomes
Michal
MichalOPβ€’2mo ago
@toeknee Sorry to bother u again... I noticed it also happens inside create/edit form of any resource inside panel that has FileUpload in it. First upload resets and then it works when uploaded second time. Is there any $form->fill() possibility in panel resource forms ? Or what could be the issue ? Many thanks.
toeknee
toekneeβ€’2mo ago
Panel should be form filled already... That is strange, can you confirm you are on the latest Filamentphp version/
Michal
MichalOPβ€’2mo ago
Thanks it is resolved now. I had just some cache on the production which I thought I deleted but it wasnt.
BrandonG
BrandonGβ€’2mo ago
hey @Michal , got the same issue, but the fill don't solve it and i have the same issue locally and in prod... Any way you could help ?
Michal
MichalOPβ€’2mo ago
Hey, also try running artisan optimize:clear πŸ™‚
BrandonG
BrandonGβ€’2mo ago
still don't work :/ in my networ tab, i've got 2 call to update, one without the file and one right after the file, i think the first one triggers a UI update but not the second one, don't know why .. maybe @toeknee have an idea ? πŸ™‚
Michal
MichalOPβ€’2mo ago
Is it custom form or inside panel ?
toeknee
toekneeβ€’2mo ago
Can you chuck together a reproduction repo so we can download it, seed and test?
BrandonG
BrandonGβ€’2mo ago
it's inside a filament modal will try to do a demo repu next week..

Did you find this page helpful?