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(rrweb): null check for pointer #208

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Conversation

michellewzhang
Copy link
Member

@michellewzhang michellewzhang requested a review from a team June 18, 2024 20:05
@@ -2179,7 +2179,7 @@ export class Replayer {
private drawMouseTail(position: { x: number; y: number }, pointerId: number) {
const pointer = this.pointers[pointerId];
Copy link
Member

Choose a reason for hiding this comment

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

This might be the trick to tell typescript that pointer could be null, then we'll get all the typehints:

Suggested change
const pointer = this.pointers[pointerId];
const pointer = this.pointers.at(pointerId);

Copy link
Member Author

@michellewzhang michellewzhang Jun 18, 2024

Choose a reason for hiding this comment

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

that gives me a lint error :(

Unsafe assignment of an `any` value. 

eslint@typescript-eslint/no-unsafe-assignment

Copy link
Member

Choose a reason for hiding this comment

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

ooh, think pointers is a Record type, i assumed array without looking.

nbd.

@michellewzhang michellewzhang merged commit 011bd05 into sentry-v2 Jun 18, 2024
14 checks passed
@michellewzhang michellewzhang deleted the mz/null-pointer-check branch June 18, 2024 20:18
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