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

this.$refs.pond.removeFiles() and this.$refs.pond._pond.removeFiles() don't work #262

Open
2 tasks done
kazvaggos opened this issue Sep 5, 2022 · 4 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@kazvaggos
Copy link

kazvaggos commented Sep 5, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Have you updated Vue FilePond, FilePond, and all plugins?

  • I have updated FilePond and its plugins

Describe the bug

Hello team.

While trying to migrate to Vue 3, we noticed that filepond's removeFiles method is not working while in Vue 2 it was working just fine.
We are expecting the uploaded files to be removed and the component to be in the initial state, but the files are not removed at all in Vue 3, while in Vue 2 they were removed as expected.

Reproduction

Our implementation is with options api.

<file-pond
      :name="name"
      ref="pond"
      :label-idle="labelIdle"
      allow-multiple="true"
      :server="server"
      :max-files="maxFiles"
      :max-file-size="maxFileSize"
      :accepted-file-types="acceptedFileTypes"
      @processfilerevert="handleFileRevert"
      @removefile="handleFileRemove"
      :fileRenameFunction="fileRenameFunction"
      @init="handleInit"
      :iconRemove="iconRemove"
      :iconRetry="iconRetry"
/>
function reset() {
  this.$refs.pond.removeFiles() // does nothing
  this.$refs.pond._pond.removeFiles() // does nothing
  this.$refs.pond.$el.getElementsByClassName('filepond--action-revert-item-processing)[0]?.click() // doesn't exist
} 

It is like when accessing this.$refs.pond, it is totally another component instance because logging this.$refs.pond.$el input id has different hash from the one rendered in the browser.

Environment

- Device: Dell Inc. XPS 13 9370
- OS: Ubuntu 22.04.1 LTS
- Browser: Version 104.0.5112.101 (Official Build) (64-bit)
- Vue version: 3.2.37
- Filepond:
    "filepond": "4.30.4",
    "filepond-plugin-file-rename": "1.1.8",
    "filepond-plugin-file-validate-size": "2.2.7",
    "filepond-plugin-file-validate-type": "1.2.8",
    "filepond-plugin-image-preview": "4.6.11",
    "vue-filepond": "7.0.3",
@kazvaggos kazvaggos added the bug Something isn't working label Sep 5, 2022
@kazvaggos kazvaggos changed the title this.$refs.pond.removeFiles() and this.$refs.pond_pond.removeFiles() don't work this.$refs.pond.removeFiles() and this.$refs.pond._pond.removeFiles() don't work Sep 5, 2022
@pbowyer
Copy link

pbowyer commented Apr 28, 2023

@kazvaggos Did you find what the cause was? I too am updating from Vue 2 to Vue 3, and in our case this.$refs.pond.processFiles() errors when called with TypeError: processFn is not a function

@oooredooo-bit
Copy link

@pbowyer do you have any updates here on how to manually trigger to upload multiple files on a separate button in Vue 3?

@pbowyer
Copy link

pbowyer commented May 31, 2023

@oooredooo-bit No I have failed to get this to work 😞

@rikschennink
Copy link
Collaborator

Just forked a test repo, see: https://stackblitz.com/edit/github-iaw3um?file=src%2FApp.vue

Line 193.

<file-pond
      ref="pond"
      server="/api"
      accepted-file-types="image/jpeg, image/png"
      allow-multiple="true"
      :imageEditor="myEditor"
      :files="myFiles"
      @init="handleFilePondInit"
/>
    handleFilePondInit: function () {
      console.log('FilePond has initialized');
      // FilePond instance methods are available on `this.$refs.pond`

      // This is for testing purposes
      this.$refs.pond.addFile('index.html').then(() => {
        this.$refs.pond.processFiles();
      });
    },

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