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 onINP() attribution error due to empty entries #452

Merged
merged 2 commits into from
Apr 1, 2024
Merged

Conversation

philipwalton
Copy link
Member

This PR fixes #451 by removing the logic) that would report 0 INP value with an empty entries array if the code detected that at least one interaction did happen but wasn't reported.

This logic is no longer necessary (given that we observe first-input entries), so as long as we always include first-input entries, there should never be an empty entries array (which is what was causing the TypeError in #451).

Note that code prior this PR assumed that any time a first-input entry was dispatched with a duration value above the durationThreshold of the event observer, then there would always be a correspondoing event entry (and thus the first-input entry was redundant). This turns out to not be true in cases where the first interaction occurs before the DOMContentLoaded event fires, so the fix is to just always include first-input entries (without trying to dedupe). (Note: this may be a Chrome bug that needs addressing, cc: @mmocny.)

/cc: @ErwinHofmanRV

@philipwalton philipwalton merged commit c963a57 into v4 Apr 1, 2024
2 checks passed
@philipwalton philipwalton deleted the inp-bug branch April 1, 2024 17:05
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.

None yet

2 participants