Unable to track file upload progress on Apollo Client v3-
owusuappiah opened this issue · 6 comments
So I have followed on what is recommended here on how to track progress on file upload. On apollo-client v3, it looks like xhr.upload.onprogress
is not really working as expected.
Issue is:
It doesn't return the progress ranges until when it is 1 (donating 100%).
Followed up on @n1ru4l's solution in this section on an attempt to solve this for Apollo Client v3, and it seems not to work.
What do you think the issue is? Are there any potential updates since these suggestions from here please?
It doesn't return the progress ranges until when it is 1 (donating 100%).
I don't know if any of that old code your reference is still a good idea, but are you sure that your files are not just small enough that it actually does upload them in one chunk?
That was what I twas thinking initially, but not really. I did test it out with files that are pretty much large. I have tried with 200MB, to 2 gigs files.
Regarding the old code reference, you are right. Not sure if there is another way to get this to work. There isnt much docs on this stuff as well, at least for this library to achieve file upload progress.
What is your best advice please?
I am also looking for a solution into this, this solution doesn't work anymore , on version v3.8.7
I don't think the community needs me to change anything about the apollo-upload-client
API to be able to figure out how to configure the fetch
options with Apollo links to track upload progress. This issue is more of a usage question about how the package and Apollo Client can be used, than a specific feature request or bug report that I must action in this codebase. As such, I am closing this issue. Not because it's not an interesting problem or that documenting how projects can figure Apollo Client to get this working wouldn't help some people, it's just that it's not something I can work on solving because I don't have the need for this in any of my projects, so I can't dedicate personal time to figuring out the right answer. Chances are, the solution could be published in a completely different package as an Apollo link projects can plug into their Apollo Client config.
If anyone figures out the right way to configure Apollo Client for upload progress, feel free to comment it here.
Some thoughts… My instinct is to keep the solution 100% native fetch
API based; web standards have improved a lot with fetch
and web streams as well as runtime support. Has anyone tried using the latest web streams APIs for the fetch
request? E.g: