Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Removaing image does not update attribute #9

Open
mbs047 opened this issue Jul 31, 2024 · 6 comments
Open

[Bug]: Removaing image does not update attribute #9

mbs047 opened this issue Jul 31, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mbs047
Copy link

mbs047 commented Jul 31, 2024

Issue Description

When you upload an image, save the record, then edit the form, and remove the image, the attribute is not updated correctly.

Suggested Solution

To address this issue, update the remove method in your FilePond configuration to ensure that Livewire is correctly notified about the file removal. Instead of using file.name to remove the file, you should set the attribute to an empty string, which will clear the current value.

Here is the updated code:

remove: (file, load) => {
    console.log(file);
    @this.set('{{ $wireModelAttribute }}', null); // Set the attribute to an empty string to fix the issue
    load();
},

How to Reproduce the Issue

  1. Create a Form: Set up a simple form that includes a file upload field.
  2. Upload an Image: Use the form to upload an image.
  3. Edit the Form: Reload the form with the existing data.
  4. Remove the Image: Remove the image from the form.
  5. Save the Form: Save the changes and dump the values to verify the issue.
@Naimul007A
Copy link

when I have multiple files But i want to remove just one.this time what can I do?

@waheed1987
Copy link

As a workaround for now, until we get some solid solution, I have disabled the preview functionality for existing files using Filepond, I created a thumbnail or thumbnails for existing files, (with cross signs) and to upload new files, I am using filepond. Simplifies my logic a log, just duplicate variables to handle the functionality.

@KhairulAzmi21
Copy link
Contributor

when I have multiple files But i want to remove just one.this time what can I do?

did you find a solution for this ?

@Naimul007A
Copy link

when I have multiple files But i want to remove just one.this time what can I do?

did you find a solution for this ?

no :)

@mbs047
Copy link
Author

mbs047 commented Aug 27, 2024

when I have multiple files But i want to remove just one.this time what can I do?

did you find a solution for this ?

no :)

I'll check and try some methods once it works I'll share it here

@Naimul007A
Copy link

when I have multiple files But i want to remove just one.this time what can I do?

did you find a solution for this ?

no :)

I'll check and try some methods once it works I'll share it here

please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants