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

added upload started and finished events #5

Merged
merged 5 commits into from
Sep 20, 2024

Conversation

abdelhamiderrahmouni
Copy link
Contributor

Added upload started and finished events to make it easy to deal with upload progress from outside the component.

Let me Explain

I used this component and i love it, thank you for your hard work.
I just wanted to know when the upload starts and ends to disable/enable the submit button in my forms.
The problem was using the wire:loading attribute resulted in the button getting enabled and disabled two times for some reason but using the events it was fixed.

… upload progress from outside the component.
@Fabstilelook
Copy link

Can you add also removed event?

@abdelhamiderrahmouni
Copy link
Contributor Author

Done i have added both filepond-upload-reverted and filepond-upload-file-removed events.

@blindpenguin
Copy link

Hi, i think there is a bit of a typo in there in line 64:

$dispatch('filepond-upload-finished', {'{{ $wireModelAttribute }}', response });

There should be a colon, not a comma before "response". Like this:

$dispatch('filepond-upload-finished', {'{{ $wireModelAttribute }}': response });

@drifteaur
Copy link

Thanks, this is necessary. If the form containing the filepond component is submitted before all of the files are uploaded, only some of the files will appear on the backend.

@abdelhamiderrahmouni
Copy link
Contributor Author

here you go it's fixed now 👍, please let me know if there are any necessary additions.

@riasvdv riasvdv merged commit 1efc147 into spatie:main Sep 20, 2024
1 check passed
@riasvdv
Copy link
Member

riasvdv commented Sep 20, 2024

Thanks!

@abdelhamiderrahmouni
Copy link
Contributor Author

A pleasure 😁

@booni3
Copy link

booni3 commented Oct 14, 2024

I have created issue #27

The below event throws exception "Only arrays and Traversables can be unpacked".

$dispatch('filepond-upload-started', '{{ $wireModelAttribute }}');

I am unsure if any extra information is available at this point, so maybe the event should just be:

$dispatch('filepond-upload-started');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants