Repeater with Fileupload doesn't update previews on using $set
Hi all. I am using a Filament repeater with 3 field. 2 Textinputs and 1 Fileupload. I am using another fileupload to fetch multiple images then make a repeater field based on number of images so that description can be added to each of the image.
When I use $set to dynamically update my repeater, the data is there but no preview is shown by file upload it just shows original UI to select a file. Is there a better way to do this?
6 Replies
Can you share your set function?
The data is getting copied properly and even saved on clicking create button and loaded when edit page opens after saving model with preview correctly. Only issue is not showing after using $set to end-user.
Images needs to be an array of arrays
Looks like you might be doing that though.
What if you remove statePath from the images repeater? That’ll be the default from the make(). Maybe it’s creating a path of images.images
Something feels off about this to me though since the image paths are temp URLs until the form is saved.
These $images is an array of $key and TemporaryUploadFile Instances
Should I save files before copying to other field?
The Path is correct as other fields and even this one are getting copied properly. Only issue is previewing.
They are not just URLs, they are instances of TemporaryFileUpload
I know. But that is still a path.
It’s just path to livewire-tmp instead of the final destination path on save. I’m wondering if the uuid is getting changed using set resulting in an invalid mapping to the temporary file.
Is there a reason to go through this trouble vs just uploading an image to each repeater item, since the items don’t necessarily always have the same number of items?
I’m also not seeing a ->live() on any of the fields so the the repeater will never get updated “in real time”
Actually the user wants to upload say 20 files at the same time but then after uploading needs to enter the other two fields for each of the image. Is there an alternate way to do this?
If I save files in action and then send them to repeater, previews are loading correctly
But the issue is, in this case the user may navigate away without saving model and files will be there. How to handle this?