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

XMLHttpRequest progress event has event.total, but event.loaded is always 0 #16369

Closed
butchmarshall opened this issue Oct 15, 2017 · 4 comments
Closed
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@butchmarshall
Copy link

butchmarshall commented Oct 15, 2017

I was running RN 0.42 and saw this. I then upgraded to 0.46.4 and am still encountering the same results. My device is running Android 7.

The XMLHttpRequest object fires progress events, but returns 0 bytes loaded until completed.

var xhr = new XMLHttpRequest();
xhr.open("GET", "/my/api/with/content-length", true);

xhr.addEventListener('progress', function(event) {
	if (event.lengthComputable) {
		console.log(event.loaded, event.total);
	}
}, false);

xhr.send()

My console shows lots of progress events and the request completes successfully, but loaded is always 0

10-14 21:41:59.138 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.139 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.140 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.141 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.142 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.143 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.143 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.144 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.145 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.146 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.147 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.148 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.149 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.150 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.150 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.151 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.152 17907 19666 I ReactNativeJS: 0, 4183950
10-14 21:41:59.153 17907 19666 I ReactNativeJS: 0, 4183950

Using Chrome the same code/endpoint successfully reports the loaded progress.

@react-native-bot
Copy link
Collaborator

@facebook-github-bot no-template

@facebook-github-bot
Copy link
Contributor

Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more.

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Oct 15, 2017
@dolo098
Copy link

dolo098 commented Feb 14, 2018

I'm having this issue also, any updates on this?

@butchmarshall
Copy link
Author

Yes, I fixed it and issued a pull request here.

I don't have any idea how to push the pull requests merge forward, however...

@facebook facebook locked as resolved and limited conversation to collaborators Oct 15, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants