Skip to content

Fix possible web crashes #3553

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

billouboq
Copy link
Contributor

Description

Without being able to reproduce, we saw some possible web crashed happening in react-native-gesture-handler.
So adding more guards to avoid that

Here are the sentry crashed :
Screenshot 2025-06-12 at 10 53 08
Screenshot 2025-06-12 at 11 02 58

@billouboq billouboq changed the title Fix possible web crashed Fix possible web crashes Jun 12, 2025
@m-bert
Copy link
Contributor

m-bert commented Jun 16, 2025

Hi @billouboq! First of all, thanks for this PR! Is there any stack trace for the first error? Looking at the code, situation where last coordinates are undefined shouldn't happen in this function, so it would be great to see what causes that behavior.

@billouboq
Copy link
Contributor Author

@m-bert Unfortunatly, we couldn't have more details about that, it was only showing in Sentry and not a single user reported an issue, and we cannot reproduce on our side

@m-bert
Copy link
Contributor

m-bert commented Jun 16, 2025

Okay, I'll try to find out what is the root cause. What Gesture Handler version do you use? I assume it was reported on 2.25.0

@m-bert
Copy link
Contributor

m-bert commented Jun 17, 2025

Hi again @billouboq! Unfortunately I was not able to reproduce it, though I think it may be caused by one of the following:

  1. Pointer is removed form PointerTracker before handler enters BEGAN state - removing may happen for example when one lifts pointer from the view.
  2. PointerTracker is reset before handler enters BEGAN state - this one can happen when pointercancel event is received.

For now I can't see any other possibility, but also I'm not sure how Gesture Handler may enter one of those two states.

Either way, we decided to fix it in a different way (which hopefully will work). I created #3565 which should solve this problem. It would be great if you could test it, but I understand that it may be challenging.

About this PR, please leave only the second fix, for hasPointerCapture - if CIs pass then we can merge it 😅

@m-bert
Copy link
Contributor

m-bert commented Jun 26, 2025

Hi @billouboq! Just to let you know, I've merged #3565, so these changes are no longer necessary in this PR

@billouboq
Copy link
Contributor Author

Thanks a lot for the changes ! 🙏

@m-bert
Copy link
Contributor

m-bert commented Jun 26, 2025

So are you willing to contribute to fix the other crash? 😅 If so, please leave only changes in PointerEventManager

@billouboq
Copy link
Contributor Author

Will do right now otherwise I know I will never take the time to do it 😁

@billouboq billouboq force-pushed the billou/fix-web-possible-crash branch from 9f0538f to 538ced5 Compare June 26, 2025 10:50
@billouboq
Copy link
Contributor Author

@m-bert Done

Copy link
Contributor

@m-bert m-bert left a comment

Choose a reason for hiding this comment

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

Thank you! ❤️

@m-bert m-bert merged commit 6e31b0b into software-mansion:main Jun 27, 2025
1 check passed
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