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 infinite call loop after close event dispatch #43

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

EmilJunker
Copy link
Contributor

In the current version, calling es.close() from the close event handler results in an infinite call loop (es.close() triggers the close handler and the close handler calls es.close() again). This eventually leads to a Maximum call stack size exceeded error being thrown by React Native.

es.addEventListener('close', () => {
    es.close();
});

This PR fixes that problem.

Surfaced in #37 (comment)

Copy link
Collaborator

@wojciechkrol wojciechkrol left a comment

Choose a reason for hiding this comment

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

Looks good!

@wojciechkrol wojciechkrol merged commit d6434ac into binaryminds:master Feb 23, 2024
@EmilJunker EmilJunker deleted the fix-close-event branch February 23, 2024 11:27
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