Skip to content
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 sendEvent fired before React was fully set up #906

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abdullahizzuddiin
Copy link

@abdullahizzuddiin abdullahizzuddiin commented Nov 29, 2019

Bug

The application crashed after received notification when application is still starting up (the React instance had not been fully set up)

Caused by java.lang.RuntimeException
Tried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module.

Resolved By

Add react instance checker before emit event. Only emit event, when react instance was active

Fixes #877


This change is Reviewable

**Bug**  
The application crashed after received notification when application is still starting up (the React instance had not been fully set up)

**Resolved By**  
Add react instance checker before emit event
@conradchenghk01
Copy link

Hi @abdullahizzuddiin , any plan to include this fix in recent SDK release?

@rgomezp
Copy link
Contributor

rgomezp commented Nov 11, 2020

Thanks for submitting this PR. Has anyone found official docs regarding this or an ongoing bug in React Native related to this issue? In other words, is this a workaround or a temporary solution?

I found a similar related thread but it isn't official React Native so I want to be sure this change is the correct fix for the problem.


Update: I found an example of this being used here

While adding this check may patch the issue, we should investigate why this is happening in the first place

@conradchenghk01
Copy link

conradchenghk01 commented Nov 11, 2020

Thanks for submitting this PR. Has anyone found official docs regarding this or an ongoing bug in React Native related to this issue? In other words, is this a workaround or a temporary solution?

Thanks @rgomezp , from crashlytics, this issue is still growing, so we wonder this workaround / fix can be apply in coming sdk release.

@conradchenghk01
Copy link

Hi OneSignal administrator, any plan to include this fix to Onesignal 4.0 sdk?
We got a spike related to this incident.

@rgomezp
Copy link
Contributor

rgomezp commented Jan 12, 2021

Howdy @conradchenghk01 ,
I am sorry to hear you're having spikes in crashes regarding this.

I will bring up to my team this week to prioritize.

@abdullahizzuddiin
Copy link
Author

Is this PR enough to solve this issue or you will create another solution? @rgomezp

Actually, I never seen this crash again after my app use this patch.

@conradchenghk01
Copy link

Thanks @rgomezp , same as @abdullahizzuddiin , we applied a patch to solve the issue too~

@mussegam
Copy link

mussegam commented Jul 2, 2021

Thanks @abdullahizzuddiin, we are using this patch to workaround this issue too.

I noticed that the SDK is already doing something similar to this in RNPushNotificationJsDelivery, maybe this info can speed up the process to merge this PR? Thanks!

ital0 pushed a commit to KyteApp/react-native-onesignal that referenced this pull request Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tried to access a JS module before the React instance was fully set up
5 participants