question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Abort not working on autoUpload = false OR Who to remove one file from the List?

See original GitHub issue

Describe the bug When autoUpload is false and abort is called the item will not be removed .

Expected behavior Abort deletes the file from the list OR a remove method is provided.

Versions@rpldy/uploady”: “^0.8.3”, “@rpldy/upload-drop-zone”: “^0.8.3”, “@rpldy/uploader”: “^0.8.3”, “@rpldy/sender”: “^0.8.0”, “@rpldy/shared”: “^0.8.0”,

Code


const FileItems = () => {
  const abort = useItemAbort();
  const [files, setFiles] = useState([]);
  useBatchAddListener((batch: Batch) => {
    setFiles(prevState => [...prevState, ...batch.items]);
  });

  useItemAbortListener((batch: BatchItem) => {
    debugger;
  });

  useBatchAbortListener(batch => {
    debugger;
  });

  useAllAbortListener(() => {
    debugger;
  });

  return files.map(file => <FileItem file={file} onClick={() => abort(file.id)} />)
}

const App = () => {
  return <Uploady autoUpload={false} >
      <FileItems />  
   </Uploady
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
yoavnirancommented, Jan 11, 2021

I wouldnt like to expose the uploader instance unless there’s a very strong case for it

In any case, Ive a solution I believe will work nicely. Abort will take care of pending uploads and Uploady context will have the clearPending method available.

This way you’ll be able to cancel individual (pending) uploads or all of them together

0reactions
LukasOchmanncommented, Jan 11, 2021

Thank you for your Response and for accepting it as an enhancement,

yes line 43 was a mistake, i was in a hurry…

i also prefer an solution wich modifies the abort method. With an extra method for that usecase i had to evaluate the current files state instead of simply aborting it.

As an alternativ to exposing the Uploder instance, could the Uplody take a prop “instance” wich takes in an custom Uploder Instance? or maybe an higher order Component withCustomUploder

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can i remove some file from fineuploader before upload
To remove a file (before it has started or completed uploading), simply cancel it via the cancel API method. For example:
Read more >
Remove a file from async upload list. in Kendo UI for jQuery
I have a kendo upload on one of my forms. This upload button has the following async, multiselect, autoUpload = false, batch =...
Read more >
Upload component throws NPE upload.setAutoUpload ...
setAutoUpload(false); and click "x" to remove file in the list Steps to reproduce Create Upload, select multiple files and click to remove ......
Read more >
Options Core
When true the cancel link does not appear next to files when the form uploader is used. Type: Boolean. Default Value: false. formatFileName....
Read more >
Why is my Hero 10 unable to auto upload to the cloud?
Sorry to hear you're experiencing issues with the Auto Upload on your GoPro. Please try the following: Run a factory reset in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found