Skip to content

Fix file upload progress #1133

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

Merged
merged 4 commits into from
Apr 7, 2020
Merged

Fix file upload progress #1133

merged 4 commits into from
Apr 7, 2020

Conversation

JeromeDeLeon
Copy link
Contributor

Based on the discussion from #1096

Thanks to @ladigitale for the advice. 👍

@codecov
Copy link

codecov bot commented Apr 2, 2020

Codecov Report

Merging #1133 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1133   +/-   ##
=======================================
  Coverage   92.29%   92.30%           
=======================================
  Files          54       54           
  Lines        5230     5235    +5     
  Branches     1168     1169    +1     
=======================================
+ Hits         4827     4832    +5     
  Misses        403      403           
Impacted Files Coverage Δ
src/RESTController.js 84.51% <100.00%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2081dc2...a3a7fb6. Read the comment docs.

@JeromeDeLeon
Copy link
Contributor Author

I tested it without type and worked just fine. No duplication. Maybe the browser handles the calling of progress behind the scene if it should be calling progress for upload or progress for download.

Copy link

@ladigitale ladigitale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thank you.

Could the type parameter be set at the end, because otherwise i think it could break code which is relying on previous behaviour. i mean code that expect that the progress value is at first place.
Wouldn't it be more "secure" to use this new parameter in the form of an object.
indeed, in the futur, if more data must be added it could be filled in this object seamlessly

@JeromeDeLeon
Copy link
Contributor Author

I was thinking the same thing like putting loaded and total into an object allowing the future values to be wrapped into an object or putting type as an object at the end of the parameter but then again, the type could possibly remove if we could determine about the collision of upload progress and download progress. If you could test it on your end, that would be great help 👍

Copy link
Member

@dplewis dplewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Nice code cleanup

@dplewis dplewis changed the title Add upload progress Fix file upload progress Apr 7, 2020
@dplewis dplewis merged commit b9e360f into parse-community:master Apr 7, 2020
@JeromeDeLeon JeromeDeLeon deleted the upload-progress branch April 7, 2020 01:39
@ladigitale
Copy link

I just found the time to test the pacth.
As expected at the end of the upload with this code you will yet have 2 consecutive callbacks of the same function with different meanings :

1 14535341 14535341 (meaning end of the upload)
1 165 165 (meaning end of the download sent as one chunk because of the low size of the response)

Thats why aditionnal imformations / api evolution would have been usefull.

however I really thank you for that work.

@ladigitale
Copy link

ladigitale commented Apr 7, 2020

I hope I 'm not arrogant while writing. English is not my best part.
:)

@JeromeDeLeon
Copy link
Contributor Author

Seems like type is really necessary there to distinguish the difference of the two (upload and download). I'll try to push another PR and let you know about it.

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 this pull request may close these issues.

3 participants