-
Notifications
You must be signed in to change notification settings - Fork 125
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: dead click fixes from watching in prod #1508
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms) | ||
// we want to timeout eventually even if nothing else catches it... | ||
// we leave a little longer than the maximum threshold to give the other checks a chance to catch it | ||
const absoluteTimeout = checkTimeout(click.absoluteDelayMs, this._config.mutation_threshold_ms * 1.1) |
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 saw absolute timeouts, without seeing mutation timeouts, that also seems wrong so...
$dead_click_selection_changed_delay_ms: click.selectionChangedDelayMs, | ||
}, | ||
{ | ||
timestamp: new Date(click.timestamp), |
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.
turns out this is how you set the timestamp on an event
/* | ||
* Check whether an element has nodeType Node.ELEMENT_NODE | ||
* @param {Element} el - element to check | ||
* @returns {boolean} whether el is of the correct nodeType | ||
*/ | ||
export function isElementNode(el: Node | Element | undefined | null): el is Element { | ||
return !!el && el.nodeType === 1 // Node.ELEMENT_NODE - use integer constant for browser portability | ||
} | ||
|
||
/* | ||
* Check whether an element is of a given tag type. | ||
* Due to potential reference discrepancies (such as the webcomponents.js polyfill), | ||
* we want to match tagNames instead of specific references because something like | ||
* element === document.body won't always work because element might not be a native | ||
* element. | ||
* @param {Element} el - element to check | ||
* @param {string} tag - tag name (e.g., "div") | ||
* @returns {boolean} whether el is of the given tag type | ||
*/ | ||
export function isTag(el: Element | undefined | null, tag: string): el is HTMLElement { | ||
return !!el && !!el.tagName && el.tagName.toLowerCase() === tag.toLowerCase() | ||
} | ||
|
||
/* | ||
* Check whether an element has nodeType Node.TEXT_NODE | ||
* @param {Element} el - element to check | ||
* @returns {boolean} whether el is of the correct nodeType | ||
*/ | ||
export function isTextNode(el: Element | undefined | null): el is HTMLElement { | ||
return !!el && el.nodeType === 3 // Node.TEXT_NODE - use integer constant for browser portability | ||
} | ||
|
||
/* | ||
* Check whether an element has nodeType Node.DOCUMENT_FRAGMENT_NODE | ||
* @param {Element} el - element to check | ||
* @returns {boolean} whether el is of the correct nodeType | ||
*/ | ||
export function isDocumentFragment(el: Element | ParentNode | undefined | null): el is DocumentFragment { | ||
return !!el && el.nodeType === 11 // Node.DOCUMENT_FRAGMENT_NODE - use integer constant for browser portability | ||
} |
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.
moved these from auto capture code since we now have an element utils for them to live in
Size Change: +90 B (0%) Total Size: 3.01 MB
ℹ️ View Unchanged
|
turned on dead clicks in prod
watched what we captured realised some things could be improved