Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RNTesterIntegrationTests can fail due to the warning "Can't call setS…
…tate (or forceUpdate) on an unmounted component." (#24984) Summary: When running the RNTesterIntegrationTests from the XCode IDE or xcodebuild command line, its possible for tests to intermittently fail due to the warning `'Warning: Can\'t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.%s', '\n in RNTesterApp.` . A setState() call could happen in the AsyncStorage callback after the component had unmounted: presumably because the test ran and concluded before AsyncStorage returned. Changed RNTesterApp.ios.js to maintain a _mounted field that is set and cleared in componentDidMount() and componentWillUnmount() and refrain from calling setState() if the flag is false. ## Changelog [iOS] [Fixed] - Fixed RNTesterApp to not call setState() after the component has been unmounted. Pull Request resolved: #24984 Differential Revision: D15447898 Pulled By: hramos fbshipit-source-id: b01bc0a40a4f4d548aca0a4bb891ba3f4c8d0612
- Loading branch information