-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Fix bug preventing native SDK from being called after reinitialization #3200
Conversation
This commit addresses a bug in the Sentry React Native integration that occurs when calling `Sentry.init({ enableNative: true })`, followed by `Sentry.close()`, and then re-calling `Sentry.init({ enableNative: true })`. The bug prevents the native SDK from being invoked after the reinitialization. The issue resides in the closeNativeSdk() method, where the enableNative flag is incorrectly used to determine whether the native SDK should be closed. This flag is not being updated correctly after reinitialization, causing the SDK to remain disabled. With this change, the nativeIsReady flag is used to determine whether the native SDK should be closed, ensuring that subsequent reinitialization correctly enables the native SDK functionality. This fix ensures that the native SDK will be called as expected after reinitializing with enableNative: true, resolving the issue where the SDK was not invoked due to the bug in the closeNativeSdk() method.
Hi, I believe the fix should be in the The |
Fair enough! I will change it there |
@krystofwoldrich done! |
@mateioprea Looks good, I'm thinking about some tests to prevent this in the future, but nothing comes to mind. Can you update the changelog? |
b8199ef
to
073ded8
Compare
@krystofwoldrich done. I had my previous PR opened and I made a mistake in the CHANGELOG file, but i fixed it. I cannot think of any test cases for now as well. Thank you! |
@krystofwoldrich any news here? :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the detailed information and the fix. Looks good. 🚀
Tested with the sample app.
📢 Type of change
📜 Description
This commit addresses a bug in the Sentry React Native integration that occurs when calling
Sentry.init({ enableNative: true })
, followed bySentry.close()
, and then re-callingSentry.init({ enableNative: true })
. The bug prevents the native SDK from being invoked after the reinitialization.The issue resides in the
closeNativeSdk()
method, where theenableNative
flag is incorrectly used to determine whether the native SDK should be closed. This flag is not being updated correctly after reinitialization, causing the SDK to remain disabled.With this change, the
nativeIsReady
flag is used to determine whether the native SDK should be closed, ensuring that subsequent reinitialization correctly enables the native SDK functionality.This fix ensures that the native SDK will be called as expected after reinitializing with enableNative: true, resolving the issue where the SDK was not invoked due to the bug in the
closeNativeSdk()
method.💡 Motivation and Context
💚 How did you test it?
In my App.
📝 Checklist
sendDefaultPII
is enabled🔮 Next steps