Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to cancel file upload correctly #847

Open
maryam4s26 opened this issue Mar 6, 2024 · 1 comment
Open

Failure to cancel file upload correctly #847

maryam4s26 opened this issue Mar 6, 2024 · 1 comment

Comments

@maryam4s26
Copy link

Hi @andersevenrud
I have a problem.
If I click the cancel button while uploading the file, the file upload dialog closes but the upload process is not completely canceled and the file is finally uploaded.

@andersevenrud
Copy link
Member

Sadly, there is no direct HTTP request abort available in the VFS at the moment.

It should be fairly easy to implement though, at least for file uploads.

  1. The options in the writefile() function needs to accept abort: AbortController
  2. Which is then passed on to the system adapter writefile()
  3. Which is again passed on to the HTTP request abstraction
  4. Then the file manager can trigger the abort on dialog cancel

const aborter = new AbortController()

vfs.writefile({ /* */ }, file, {
  abort: aborter
})

// In a dialog callback
(btn) => {
  if (btn === 'cancel') {
    aborter.abort()
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants