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
Is your feature request related to a problem? Please describe.
I have a use case, let say I want to upload a file and for some reasons my onDrop function has gone into error state e.g Server responded with error. Now the Image thumbnail is still in the preview list. There is no way I can remove the file from the list or Identify that an error has occurred for that.
importReact,{useState}from'react';import{ImageInput,ImageField}from'react-admin';exportconstUploadImage=(props)=>{const[imageId,setImageId]=useState();return(<ImageInputaccept="image/*"source="profileImage"reference="user"multiple={true}options={{onDrop: async([file])=>{// Assume this will failtry{constid=awaituploadToServer(file)setImageId(id);}catch(e){// Remove Image Preview Here...}}}}><ImageFieldsource="profileImage"/></ImageInput>)}
Describe the solution you'd like
I have seen this issue ImageInput keeps adding imagest to state, this works fine. It would be great if we have a way to trigger the removal process through JS (without clicking the remove button)
Describe alternatives you've considered
I can't think of any alternative solution to this issue as the state which is keeping the track of file items is maintain inside the FileInput.tsx
Before I was not sure which template to follow that is why i tried my best to explain this in well formatted way. But I believe it is more of a feature request so I have followed the new feature template.
master branch is feature-freeze, but a solution for this has been implemented already in version 4 #7003.
So I'm closing this feature request as it has been implemented.
Is your feature request related to a problem? Please describe.
I have a use case, let say I want to upload a file and for some reasons my
onDrop
function has gone into error state e.g Server responded with error. Now the Image thumbnail is still in the preview list. There is no way I can remove the file from the list or Identify that an error has occurred for that.Describe the solution you'd like
I have seen this issue ImageInput keeps adding imagest to state, this works fine. It would be great if we have a way to trigger the removal process through JS (without clicking the remove button)
Describe alternatives you've considered
I can't think of any alternative solution to this issue as the state which is keeping the track of file items is maintain inside the FileInput.tsx
and there is no way to change that state.
The text was updated successfully, but these errors were encountered: