Description
Is there an existing issue for this?
- I have searched the existing issues
Have you updated FilePond and its plugins?
- I have updated FilePond and its plugins
Describe the bug
I'm using FilePond 4.30.4.
Images that are pasted upload multiple times under some circumstances.
Reproduction
I have a FilePond in a dialog in a Vue application. When I show the dialog, I can drag and drop images, no worries. I can also paste images copied from another browser page without problems. If I close and then reopen the dialog, I can still drag and drop images OK, but if I paste an image copied from another browser tab, the image uploads twice. If I close and reopen the dialog again, the pasted image uploads three times. Again, no problems with drag and drop.
I got far enough into the code to find that some listeners weren't being removed when the dialog was closed.
Let me know if the above isn't enough to reproduce and I'll see if I can put a sandbox together. It's kinda complex.
The component looks like this:
<file-pond
class="fit"
name="file"
ref="pond"
class-name="mvow-pond"
:label-idle="`${uploadIcon} ${props.uploadPrompt}`"
:allow-multiple="true"
:allow-revert="false"
:allow-file-type-validation="true"
:accepted-file-types="acceptedFiles"
:file-validate-type-detect-type="fileValidateTypeDetectType"
:file-metadata-object="extraFormFields"
:server="uploadOptions"
:image-resize-target-width="resizeWidth"
:image-resize-target-height="resizeHeight"
image-resize-mode="contain"
:image-resize-upscale="false"
>
</file-pond>
I worked around the problem. When the dialog box is closed, I do this:
pond.value._pond.destroy()
I tried setting v-if="showDialog"
on the FilePond component (same as the dialog component's v-model), but this didn't make a difference.
Thanks for your work, I very much appreciate it.
Environment
- Device: PC
- OS: Linux, Windows 11
- Browser: Chrome, Firefox