React native development errors caught by old network request's catch()
I'm going to keep this relatively high level as I can't seem to re-create it in the demo app... But I'm having the weirdest problem in React Native 0.29.1 on iOS.
When there is an error thrown during the execution of the React Native code in dev mode on the iOS simulator, it is caught by a random catch() block from an old fetch request that completed long in the past.
When there is a dev error, it is passed as the err inside catch(err => console.log(err)). It then causes this very weird series of errors to appear in the console:
1st: ExceptionsManager.js:70 Warning: There is an internal error in the React performance measurement code. Did not expect componentDidUpdate timer to start while render timer is still in progress for another instance.
2nd: ExceptionsManager.js:55 Cannot read property 'getHostNode' of null
3rd: ExceptionsManager.js:70 Unhandled JS Exception: Cannot read property 'getHostNode' of null
I am seeing this exact same thing and it seems that the cause is exactly the same, that is it is coming from a .catch(err => console.log(err)).
Here is the stack trace. This is not in React Native, but is coming from React ^15.0.1, React-Redux ^4.4.5, and Redux ^3.5.2 (full package.json can be seen here)
warning.js:44
beginLifeCycleTimer @ ReactDebugTool.js:106
onBeginLifeCycleTimer @ ReactDebugTool.js:212
invokeComponentDidUpdateWithTimer @ ReactCompositeComponent.js:63
notifyAll @ CallbackQueue.js:67
close @ ReactReconcileTransaction.js:81
closeAll @ Transaction.js:204
perform @ Transaction.js:146
perform @ Transaction.js:138
perform @ ReactUpdates.js:90
flushBatchedUpdates @ ReactUpdates.js:173
closeAll @ Transaction.js:204
perform @ Transaction.js:151
batchedUpdates @ ReactDefaultBatchingStrategy.js:63
enqueueUpdate @ ReactUpdates.js:201
enqueueUpdate @ ReactUpdateQueue.js:25
enqueueSetState @ ReactUpdateQueue.js:209
ReactComponent.setState @ ReactComponent.js:64
handleChange @ connect.js:301
(anonymous function) @ makeAssimilatePrototype.js:15
dispatch @ createStore.js:186
dispatch @ VM23790:1570
(anonymous function) @ index.js:208
(anonymous function) @ index.js:38
(anonymous function) @ index.js:9
dispatch @ applyMiddleware.js:45
(anonymous function) @ stations.js:85
+1
+1
react-native 0.27.2
+1
+1
+1
+1
I'm getting this with react 15.3.0, redux 3.5.2, react-redux 4.4.5. I'm not using react-native, so it's something with react in general.
+1, this is driving me crazy.
All internal errors are now caught by the closest .catch() and there's no useful information in the stack trace this way. I get the same result using a reject function as the second argument of the .then()
Using react-native 29.2 but this is not a new bug.
Simply removing the .catch() will only convert the error into an Possible Unhandled Promise Rejection so that does not help.
my promises and the ones used internally in react-native should never be able to touch.
+1
Could someone who has this without react-native post an issue on the react git? Perhaps there they know what to do
btw, I only get Cannot read property 'getHostNode' of null if I use this.props.children.
I was able to use this.props.children in the example app so perhaps it's a dependency messing things up?
here are my deps:
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native-stage-0": "^1.0.1",
"backbone": "^1.3.3",
"backbone-relational": "^0.10.0",
"jquery": "^3.1.0",
"levenshtein": "^1.0.5",
"react": "^15.2.1",
"react-native": "^0.29.2",
"react-native-barcodescanner": "^3.0.0",
"react-native-button": "^1.4.2",
"react-native-dismiss-keyboard": "^1.0.0",
"react-native-drawer": "^2.2.6",
"react-native-keyboard-spacer": "^0.3.0",
"react-native-router-flux": "^3.34.0",
"react-native-sound": "^0.8.3",
"react-native-vector-icons": "^2.0.3",
"react-redux": "^4.4.5",
"redux": "^3.5.2"
well, in my case, fetch throw exception with status code 204.
even whatwg-fetch return ok = true. anyone has same experience as mine?
because of this issue, I have to return 200 status code after deleting contents
For what it's worth, this hasn't seemed to be happening to me as much with RN 0.33.0. I have also not been working with writing network requests recently so... could be false alarm.
Anecdotally this seems like it's better now so I am going to close this issue. If someone has a specific repro app that reproduces this problem on modern react native then I think it would be great to open a new issue though. Thanks for bringing this up!