-
Notifications
You must be signed in to change notification settings - Fork 134
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: type error accessing null object and added test case #1620
Conversation
@supermar1010 is attempting to deploy a commit to the PostHog Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 question and 1 requested change
but this is 💯, absolutely love you took the time to PR 🙌
src/utils/element-utils.ts
Outdated
@@ -1,8 +1,8 @@ | |||
import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants' | |||
|
|||
export function isElementInToolbar(el: Element): boolean { | |||
export function isElementInToolbar(el: Element | null): boolean { | |||
// NOTE: .closest is not supported in IE11 hence the operator check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totally fly-by note for myself that this comment is probably out of date now that we're making ES6 and ES5 bundles separately
$heatmap_data: { | ||
'http://replaced/': [ | ||
{ | ||
target_fixed: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, does this mean that the mousemove event has no clientX or clientY?
if so we're actually better ignoring them completely since the data is invalid without a coordinate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a mouse move event without any clientX or clientY. According to mozilla dev everything is optional, so it is valid to send an event with any data.
Yeah ignoring is probably a good call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're welcome to add that to this PR - if you're interested?
i can do as follow-up otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're already dropping events with no x and y during ingestion, so it's only a nice-to-have not to omit them (although good to not do work)
so only open question for me is if you'd like to handle that in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd leave that to you, I'm not sure where you'd implement that filtering.
Unit tests should run successful now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
We stumbled onto this bug, with rxdb dispatching mouse events without data and thus producing a posthog crash.
This typecast is why the error wasn't spotted by ts. The type of
e.target
is originallyEventTarget | null
, but looses the| null
in this cast.Checklist