SpatieMediaLibraryFileUpload auto saving
Suggestions for automatically saving the uploaded or reordered images automatically without. I know i can probably do afterStateUpdated(), but then I have to figure out all the logic to do the save. I know I cant just do
$this->form->getState()
like i would if it was a submit method. Must be something similar though. Thoughts?13 Replies
im using it with s3 if it makes a difference
basically can i tap into the same "magic" that
$this->form->getState()
does but with afterStateUpdated() or whatever other method you suggestCan you get it via
fn ($livewire) => $livewire->getFormState()
or similar?@Dennis Koch great idea, a little tweak, but
->afterStateUpdated(fn($livewire) => $livewire->form->getState())
does the jobMaybe even mutateFormDataBeforeSave($data)
There’s another one for create too.
I think he wants instant save.
Could be.
yep, i want instant save. Its not saving order for some reason though. need to see if thats triggering properly after a image reorder
yep, changing order does not trigger afterStateUpdated()
i don't know that it can since the ordering is on the front end via JS
@awcodes dont say that and ruin my day 😛
looking at the code it looks like it should be though
well its not saving and i threw a ray() into that afterStateUpdate() and it never ran when i reordered.
is there a network request sent when you reorder them?
for some reason sometimes ray() doesn't log inside callbacks. Haven't figured that one out yet.
hmm, it does do a network request with a livewire message
i verified though that using a submit button and , the order is properly being saved.