-
Notifications
You must be signed in to change notification settings - Fork 943
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
Reactotron will crash first app runs on real iOS devices #1473
Comments
@morganick this happens since 5.0.4 version, you can use 5.0.3 |
Same here for RN 0.73.7, invalid host in debug mode and crash in release mode (test flight). |
@migueldaipre Are you conditionally requiring Reactotron so that it only exists in dev everywhere you use it in your app? Reactotron shouldn't exist in your release mode app at all. e.g., reactotron/docs/quick-start/react-native.md Lines 95 to 97 in e41f128
|
Hmm, I think I've found the problem, I call Reactotron.configure conditionally ... But the reactotron import is still in the file. That's probably it. Thanks @lindboe |
Same on 0.74.0. App has a hard crash on launch only in release versions. |
use "reactotron-react-native": "5.0.3", and you won't have the crash in TestFlight or Release |
Here is the workaround without downgrading Reactotron. // reactotron-setup.ts
export const setupReactotron = () => {
if (__DEV__) {
const AsyncStorage = require('@react-native-async-storage/async-storage').default;
const Reactotron: ReactotronReactNative = require('reactotron-react-native').default;
const { reactotronRedux } = require('reactotron-redux');
return Reactotron.configure({ name: 'React Native Demo' })
.setAsyncStorageHandler(AsyncStorage)
.use(reactotronRedux())
.useReactNative({ log: true })
.connect();
}
return undefined;
}; Then call the setup function wherever you need. |
Please keep discussion to the issue described in this ticket: Reactron crashing in dev with |
## Please verify the following: - [x] `yarn build-and-test:local` passes - [x] I have added tests for any new features, if relevant - [ ] `README.md` (or relevant documentation) has been updated with your changes ## Describe your PR Fixes #1473 where calling split on an invalid string throws a `TypeError`. In the event that the following line does not provide us with a valid URL: https://github.com/facebook/react-native/blob/b38f80aeb6ad986c64fd03f53b2e01a7990e1533/packages/react-native/React/CoreModules/RCTSourceCode.mm#L38 We should catch this and warn the user that we are falling back to the default host: ``` WARN getHost: "Invalid URL: null" for scriptURL - Falling back to localhost ``` ## How to Reproduce I was unable to reproduce this issue locally with my devices as it would not crash the application, but just throw the error. Due to the circumstances of the original issue and that applications configuration, this should allow that application to continue to boot. ## Additional Notes It is still possible to configure Reactotron with an invalid host. This will equally throw an error of `invalid url`. I'd like to create a new PR that allows the application to continue to function, keeps Reactotron is a disconnected state, and notifies the user.
Describe the bug
On the first run of an RN app on a real iOS device (dev build), Reactotron will throw
invalid host
, which can lead to crashing the app (here because we were trying to add the reactotron redux enhancer to the store, but that failed, so the store failed to be created, crashing the app).I think the underlying cause of this particular crash is because we need to click "Allow" to find devices on the local network. After pressing "Allow" and reloading, the app works fine.
In addition, Reactotron should be more resilient to errors like this and avoid crashing apps. It should:
validate
tests don't crash the app if they fail. Utilities that depend on Reactotron plugins would ideally return a no-op version (e.g., the redux enhancer) so that the app can continue to work.validate
should make it more clear that they're from Reactotron in the messageNotes:
reactotron-react-native: 5.1.6
Reactotron version
3.7.0
The text was updated successfully, but these errors were encountered: