pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.91k stars 128 forks source link

[Bug] Custom load function isn't triggering #268

Closed Tauromachian closed 1 year ago

Tauromachian commented 1 year ago

Is there an existing issue for this?

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

Describe the bug

Custom load function is not triggering. Notice that I also used the process function which is working.

Reproduction

I tried the most basic configuration I could find.

<template>
  <div id="app">
    <file-pond
      name="test"
      :allow-multiple="true"
      :server="myServer"
    ></file-pond>
  </div>   
</template>

<script>
// Import filepond styles
import "filepond/dist/filepond.min.css";

// import vue filepond from vue-filepond
import VueFilepond from "vue-filepond";

const FilePond = VueFilepond();

export default {
  name: "App",
  components: {
    FilePond,
  },
  data() {
    return {
      myServer: {
        process: (asdf, asd, as, load) => {
          console.log("zxvcxcx");
          // simulates uploading a file
          setTimeout(() => {
            load(Date.now());
          }, 1500);
        },
        load: (source, load) => {
          console.log("asdf");

          // simulates loading a file from the server
          fetch(source)
            .then((res) => res.blob())
            .then(load);
        },
      },
    };
  },
};
</script>

Environment

- Device: Computer
- OS: Linux
- Browser: Brave, Polypane, Mozilla Firefox
- Vue version: 2.6.14
rikschennink commented 1 year ago

It will only trigger for local files. https://pqina.nl/filepond/docs/api/instance/properties/#files

Tauromachian commented 1 year ago

That's confusing. In the docs it states:

the load end point is used to restore already uploaded server files

It may worth to mention that adding a new file to the files array triggers the process function. When I load an already uploaded file into filepond(as a visual aid to my users) it triggers the process function. That results on files being repeated over and over on the server