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

Do not emit events until JavaScript is ready #53

Merged
merged 1 commit into from
May 17, 2024

Conversation

swansontec
Copy link
Contributor

@swansontec swansontec commented May 16, 2024

If the synchronizer is running in the background, but the app does a hot-reload, we need to stop sending events until JavaScript is ready again.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

Same thing for priatechain: EdgeApp/react-native-piratechain#11

Description

none

If the synchronizer is running in the background, but the app does a hot-reload, we need to stop sending events until JavaScript is ready again.
@swansontec swansontec force-pushed the william/fix-yellow-warning branch from 653e8ba to 576935b Compare May 16, 2024 22:20
Comment on lines +449 to +453
override func startObserving() -> Void {
hasListeners = true
}

override func stopObserving() -> Void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are startObserving and stopObserving called?

Copy link
Contributor Author

@swansontec swansontec May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These override methods in the React Native base class. React Native calls them to let us know when it's ready or not. If we fire an event when React Native is not ready, then React Native itself will throw an error. The error will either be a yellow box on the JavaScript side, or a kill-the-whole-app crash on the native side.

@samholmes
Copy link
Contributor

I approved it because it makes sense to add this to the library, but it really is up to the user of the lib to make sure these methods are called when it is determined that receiving an event would crash or not.

@swansontec swansontec merged commit 2101c32 into master May 17, 2024
3 checks passed
@swansontec swansontec deleted the william/fix-yellow-warning branch May 17, 2024 20:03
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.

2 participants