[V3] Removing upload from FileUpload does not trigger `afterStateUpdated`
Hiya!
Testing our project on V3 and found this bug(?) or at least unexpected behaviour.
I have this FileUpload field in a form with multiple files allowed. Whenever you upload a file I need to execute some code, which I do using
afterStateUpdated
. This works perfectly fine for adding files, but it's not called when you remove a file.
8 Replies
i dont think this has changed in v3
its probably also in v2
you can submit a PR to fix it if you want, preferably to v2 since we dont provide v3 support
in this case, what are you trying to do?
I guess: Uploading is handled on the server side. Removing only on client side until the form is saved.
No it's actually sending a message to server.
So upload uses Livewire's native
finishUpload
which calls syncInput
(and thus afterStateUpdated
)
Remove calls Filament's own removeFormUploadedFile
which only sets the state using state(...)
there is a way to trigger the afterstateupdated if we want to
which we can do in removeFormUploadedFile or the equivalent method in the fileupload
Yeah that's the fix I was thinking about as well
or just call syncinput
but i'd rather not do that as i know for sure that will break lw3 lol
yeah fair
is there a way in user land to trigger the afterStateUpdated somehow?
I tried listening to
updated$propname
but to no availim guessing callAfterStateUpdated() but i might be wrong