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

Handle event undefined in initMoveObserver #515

Merged
merged 1 commit into from
Mar 9, 2021

Conversation

yakkomajuri
Copy link
Contributor

@yakkomajuri yakkomajuri commented Mar 8, 2021

A quick suggestion for handling a case where this expression:

isTouchEvent(event)
        ? event.changedTouches[0]
        : event;

returns undefined, causing an error when trying to access clientX here:

const { clientX, clientY } = isTouchEvent(event)
    ? event.changedTouches[0]
    : event;

Appears to be the cause of this error: https://sentry.io/share/issue/f01259a2c753426cbfccad01c30a102b/

Happy to look into it more deeply if the approach is off - my objective here is to open a discussion via a PR rather than an issue.

@Yuyz0112
Copy link
Member

Yuyz0112 commented Mar 9, 2021

Thanks! @yakkomajuri

I think safely access the index from an array is always reasonable. And of course, it will be cool if we can find what actually happened to let the event be nullable.

@Yuyz0112 Yuyz0112 merged commit fe6341e into rrweb-io:master Mar 9, 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.

2 participants