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
Uploading a big image file is freezing an app for few seconds #15885
Comments
Maybe we can provide ref: https://github.com/ant-design/ant-design/blob/master/components/upload/UploadList.tsx#L66
|
|
Maybe it will be better if we add previewFile prop, if prop isn't passed there are 2 options: if file less than 1mb - call readAsDataURL, if bigger - show default icon. |
Data URI Limits Chrome - 2MB for the current document. Otherwise the limit is the in-memory storage limit for arbitrary blobs: if x64 and NOT ChromeOS or Android, then 2GB; otherwise, total_physical_memory / 5 (source). reference:
|
Reproduction link
Steps to reproduce
Try to upload image file with 20mb size
What is expected?
The app should work as before
What is actually happening?
The app is freezing for 4 seconds (between 10 and 14 seconds on the screenshot) on my mac (i5-7360U 2.3GHz)
It happens because Upload component tries to make thumbnail from image file. It calls FileReader for it and if file is big it will freeze the app
I think we should add size check, for example don't make thumbnail preview if image size is bigger than 10mb.
If it ok, I can do PR
The text was updated successfully, but these errors were encountered: