Vue-dropzone: vdropzone-removed-file called when dismount the component

Created on 5 May 2017  Â·  15Comments  Â·  Source: rowanwins/vue-dropzone

With the vue-router, using vue-dropzone on one router view.
After uploading the images and create a object, it redirects to other page.
Before it, vdropzone-removed-file event called and sends post requests to server to remove all files (those uploaded just before).

Most helpful comment

You can detect the difference in your vdropzone-removed-file handler by checking whether or not the dropzone element is disabled:
this.$refs.vueDropzone.dropzone.disabled !== true means that the user clicked the "Remove file" button.

All 15 comments

Hi @SmartWeb25

Im a bit confused, are you saying that this is currently occurring, or are you asking that you'd like it to occur?

Thanks

Hi @rowanwins
Sorry for being late. It's currently occurring. I used vdropzone-removed-file event to remove files from server. but since it's called automatically when dismounting the component, the uploaded server files are deleted.

Im going to close this issue as I've resolved it, I'll drop a note when I've published the new version to npm

Same problem, any solution?

Hi @LG0012

What version of vue2-dropzone are you using? Can you please restate the issue in your own language just so Im sure I understand.

Hi rowanwins, I'm using the latest vue2-dropzone version. The issue is that
when component is dismonted or for example you are changing the route, the
removed event is firing all the time. And it deletes my all uploaded
images. Right now I solved that issue by cheking the current route, and I
don't like that solution, becouse its smells like hack. Would be nice if
removed event will fire only when then, when im clicking the remove button.
By he way, sorry for my english, i hope you understand, if you want, i can
make a video and show it to you if you want that.

On Oct 5, 2017 00:44, "Rowan Winsemius" notifications@github.com wrote:

Hi @LG0012 https://github.com/lg0012

What version of vue2-dropzone are you using? Can you please restate the
issue in your own language just so Im sure I understand.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rowanwins/vue-dropzone/issues/85#issuecomment-334298615,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIAZGiAZaxrcHdJRS_sIL11bPs6NB9-Zks5so_wzgaJpZM4NSRea
.

I'm experiencing the same problem ...

version is 2.3.6

same here - v2.3.6

Same problem here.

Example case:

  • I open my EDIT PROPERTY page
  • the dropzone is pre-loaded with the existing images using manuallyAddFile
  • without doing anything, I click on a link a sidebar to go to another page
  • the remove event is fired v-on:vdropzone-removed-file="imageRemoved"

It resemble an on-blur event.

Please can we fix this somehow?
Or some workaround to avoid this behavior?

same here - v3.1.0

You can detect the difference in your vdropzone-removed-file handler by checking whether or not the dropzone element is disabled:
this.$refs.vueDropzone.dropzone.disabled !== true means that the user clicked the "Remove file" button.

whewn i use this.$refs.vueDropzone.dropzone.disabled !== true i get following error

Uncaught TypeError: Cannot read property 'vueDropzone' of undefined

@tihootech That's probably because you haven't registered "vueDropzone" as a reference: https://vuejs.org/v2/api/#ref

This is still happening for 3.6.0 btw

Happy to implement a fix for this @rowanwins

Seems like this can be fixed by setting a isDestroying file in the beforeDestroy hook and checking on that here https://github.com/rowanwins/vue-dropzone/blob/c88b8b08922cca4743a7fde03a0213e8c7a34f0f/src/components/vue-dropzone.vue#L136

Was this page helpful?
0 / 5 - 0 ratings