-
Notifications
You must be signed in to change notification settings - Fork 394
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
Multiple fetch request starts to not resolve or reject promise #10
Comments
any update? I met this issue and didn't know how to solve it |
Hi @hiennguyen92. We've just migrated this issue and I'm planning to look into it and, the others, soon. Feel free to subscribe to this issue and you will be notified when a fix is available. |
I have reproduced the error using this minimal testcase: import React, {Component} from 'react';
import {Button, View} from 'react-native';
import NetInfo from '@react-native-community/netinfo';
export default class App extends Component {
_onPress() {
const fullUrl = 'https://google.com';
for (let i = 0; i < 10; i++) {
console.log(i);
NetInfo.isConnected.fetch().then(isConnected => {
console.log('NetInfo.isConnected.fetch-success', isConnected);
fetch(fullUrl)
.then(response => {
console.log('fetch-success', response);
})
.catch(error => console.log('fetch-error', error));
}).catch(error => console.log('NetInfo.isConnected.fetch-error', error));
}
}
render() {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: "white"}}>
<Button onPress={this._onPress} title="Reproduce 🕷" />
</View>
);
}
} The error lies in the Objective C code. I will look into a fix for it. |
Encountered the same issue. |
@kriskate Thanks for posting a workaround. A proper fix for this will be coming in the next release, hopefully, this week 👍 |
🎉 This issue has been resolved in version 1.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What the bot said ⬆️ |
@matt-oakes thanks for the fix!! With this being moved out of react native core, will this fix land in the rn core version of NetInfo? or will we have to install/use this NetInfo instead? |
@dereknelson You will need to switch to this version of the library. The instructions are in the README and there have been no breaking changes since the core version aside from removing the long deprecated methods. |
@matt-oakes gotcha, I'm using expo which uses a forked version of the react-native repo so I wasn't sure how I could get this fix in there. Thanks! Edit - expo is planning on adopting this package in their SDK: expo/expo#3552 |
@dereknelson Thanks for finding that link to the Expo issue! I guess you'll need to wait for that to be included and for a new version to be released. |
See facebook/react-native#21862
The text was updated successfully, but these errors were encountered: