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 BridgeDelegate lifecycle issues #15

Merged
merged 2 commits into from
Jun 6, 2023
Merged

Conversation

jayohms
Copy link
Collaborator

@jayohms jayohms commented Jun 5, 2023

This addresses three lifecycle bugs that were overlooked:

  • When the destination's onStop() was called, the onStop() event was not passed to the destination's components, because the destinationIsActive flag was set to false before attempting to pass along the onStop() event to active components
  • The destinationIsActive flag defaulted to true instead of inspecting the destination's state directly
  • Bridge messages received in bridgeDidReceiveMessage() did not check to see if the destination was active before passing along the message to the corresponding component. This meant that if a message was received from the web after the view had been destroyed, it would lead to a crash in the component if it attempted to access its view.

…n becomes inactive and checking the lifecycle state before handling incoming bridge messages
@jayohms jayohms requested a review from mbarta June 5, 2023 18:03
Copy link

@mbarta mbarta left a comment

Choose a reason for hiding this comment

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

Nice work 💪

@jayohms jayohms merged commit 609917b into main Jun 6, 2023
@jayohms jayohms deleted the fix-delegate-lifecycle branch June 6, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants