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

[Bug] Preloader doesn't ensure order of showing or hiding #184

Open
orionmiz opened this issue Jun 5, 2022 · 1 comment · May be fixed by #185
Open

[Bug] Preloader doesn't ensure order of showing or hiding #184

orionmiz opened this issue Jun 5, 2022 · 1 comment · May be fixed by #185

Comments

@orionmiz
Copy link

orionmiz commented Jun 5, 2022

How to reproduce the bug in a custom uploader:

uploader: {
  uploadByFile(file) {
    return new Promise((resolve, reject) => {
      // e.g. checking file size, almost synchronous 
      // Pass a file with a size larger than 1024 (1kb)
      if (file.size > 1024) {
          resolve({ success: 0 });
      } else {
        // ... go on
      }
    });
  },
}

In this case, Preloader is meaninglessly being hidden first by hidePreloader following uploadingFailed,

then shown up by showPreloader following FileReader.onload (because it takes longer than the previous one)

As a result, Preloader keeps appearing despite uploading process is already over.

How to fix the bug:

Promisify FileReader and do upload after awaiting FileReader.onload

I'll send a pull request including the fix commits about this issue.

@orionmiz orionmiz linked a pull request Jun 5, 2022 that will close this issue
@orionmiz orionmiz changed the title [Bug] Preloader doesn't guarantee order of showing or hiding [Bug] Preloader doesn't ensure order of showing or hiding Jun 6, 2022
@Hypercubed
Copy link

Hello all... this is still an issue. If a custom uploader rejects before the preview is shown; the preview is not dismissed. #185 seams to fix this. Any chance of getting this PR cleanup and merged?

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

Successfully merging a pull request may close this issue.

2 participants