-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
Memory: 367.60 MB / 31.39 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.13.0 - /usr/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 24, 26, 27
Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.2, 28.0.3
System Images: android-26 | Google APIs Intel x86 Atom
npmGlobalPackages:
babel-preset-react-native: 5.0.0
react-native-git-upgrade: 0.2.7
Description
A piece of our network logic involves a delay to collect WS messages for batch sends. The relevant code looks like this:
if (!currentBatchPromise) {
logger.debug('Enqueueing new batch promise');
currentBatchPromise = new Promise((resolve, reject) =>
setTimeout(() => sendCurrentBatch(resolve, reject), 10)
);
}
Most of the time, this works fine. However, sometimes the timeout handler (sendCurrentBatch
) is never invoked. Typically, this happens when transitioning between different screens, using react-native-navigation
(v2); I’m not sure which project this bug should be filed under. I have a vague suspicion that it might be something like #22089 (“Timers do not run if specified before App mounts”), compounded by the fact that (if I understand correctly) RNN, on some level, creates more than one “app”. I do not know the details.
But it seems very…wrong…that a function like setTimeout
can somehow stop working in the middle of a running application.