Description
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 1.60 GB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.2.0 - ~/.nvm/versions/node/v10.9.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 25.0.1, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3
API Levels: 23, 25, 26
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
react-native: 0.57.3 => 0.57.3
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
svg-to-react-native-cli: 0.0.3
Description
When doing multiple fetch request one after another, not all request promises are resolved or rejected, some get lost.
I ran same code on older react native version 0.50.4 and it was working there. So its an issue in new react native.
Quite major and critical issue.
Reproducible Demo
import React, { Component } from 'react';
import { NetInfo, TouchableOpacity, Text, View } from 'react-native';
export class AppContainer extends Component {
componentDidMount() {
NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectionChange);
}
componentWillUnmount() {
NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectionChange);
}
handleConnectionChange() {
}
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'}}>
<TouchableOpacity onPress={this.onPress} style={{backgroundColor: 'red'}}>
<Text>{'Click Me'}</Text>
</TouchableOpacity>
</View>
);
}
}