You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you updated React FilePond, FilePond, and all plugins?
I have updated FilePond and its plugins
Describe the bug
When using the option type:"local" to load files in filepond a GET request to the server is made to load the file, this works as intended. But when I click on the (X) to remove the loaded file, a seemingly useless GET request is sent to the server again, but this time not at the load end-point, but at the index of the server (Which is not a valid end-point in my case and causes http 404).
Plugins used :
"filepond-plugin-get-file": "^1.0.7",
"filepond-plugin-image-exif-orientation": "^1.0.11",
"filepond-plugin-image-preview": "^4.6.11",
Reproduction
Here is my React Functional component that contains Filepond :
// Filepond
import { FilePond, File, registerPlugin } from 'react-filepond';
import FilePondPluginImageExifOrientation from 'filepond-plugin-image-exif-orientation';
import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
import FilePondPluginGetFile from 'filepond-plugin-get-file';
import 'filepond/dist/filepond.min.css';
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css';
import 'filepond-plugin-get-file/dist/filepond-plugin-get-file.min.css';
import { useController } from 'react-hook-form';
registerPlugin(
FilePondPluginImageExifOrientation,
FilePondPluginImagePreview,
FilePondPluginGetFile
);
export default function FileField({
name,
control,
rules,
defaultValue = null,
isMultiple,
fileTypes,
component_id,
}) {
const [files, setFiles] = useState(defaultValue || []);
// useController from react-hook-form probably has no impact here
const { field } = useController({ name, control, rules, defaultValue });
const pond = useRef(null);
const handleChange = () => {
let files = pond.current.getFiles();
// Set the value of the control field
field.onChange(
files.map((f) => {
return { source: f.serverId, options: { type: 'local' } };
})
);
field.onBlur();
};
return (
<div className='px-4 py-4 rounded bg-window-accent'>
<FilePond
ref={(ref) => (pond.current = ref)}
files={files}
onupdatefiles={setFiles}
onprocessfile={handleChange}
onremovefile={handleChange}
required={rules.required.value}
allowMultiple={isMultiple}
server={`/api/files/${(component_id}`}
name={'file'}
acceptedFileTypes={fileTypes}
disabled={rules.disabled}
/>
</div>
);
}
Environment
- Device: Thinkpad laptop
- OS: Windows 10
- Browser: Chrome and FireFox (latest)
- React version: 17
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Have you updated React FilePond, FilePond, and all plugins?
Describe the bug
When using the option type:"local" to load files in filepond a GET request to the server is made to load the file, this works as intended. But when I click on the (X) to remove the loaded file, a seemingly useless GET request is sent to the server again, but this time not at the load end-point, but at the index of the server (Which is not a valid end-point in my case and causes http 404).
Plugins used :
"filepond-plugin-get-file": "^1.0.7",
"filepond-plugin-image-exif-orientation": "^1.0.11",
"filepond-plugin-image-preview": "^4.6.11",
Reproduction
Here is my React Functional component that contains Filepond :
Environment
The text was updated successfully, but these errors were encountered: