filepond icon indicating copy to clipboard operation
filepond copied to clipboard

[Bug] getFiles return the old serverId on revert or undo of file in event onprocessfilerevert

Open pintuiitbhi opened this issue 4 months ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Have you updated FilePond and its plugins?

  • [X] I have updated FilePond and its plugins

Describe the bug

This is filepond react code. I am getting the old serverIds value of file instead of null. But when I do setTimeout of 1sec and then execute getFiles then it give me updated file (serverId as null which is expected one after revert or undo).

image

onprocessfilerevert={(file: FilePondFile) => { const serverIds = filePondRef.current?.getFiles().filter((file: FilePondFile) => file.serverId); console.log(serverIds) }}

Reproduction

`import { FilePond, registerPlugin } from 'react-filepond';

<FilePond onprocessfilerevert={(file: FilePondFile) => { const serverIds = filePondRef.current?.getFiles().filter((file: FilePondFile) => file.serverId); console.log(serverIds) // this should return [null] }} />`

Environment

- Device:
- OS:
- Browser:
Chrome, Firefox any version

Filepond version:
 "react-filepond": "^7.1.2",
 "filepond": "^4.31.1",

pintuiitbhi avatar Oct 12 '24 13:10 pintuiitbhi