这是indexloc提供的服务,不要输入任何密码
Skip to content

Guard INP attribution no entries #636

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

Closed
wants to merge 3 commits into from

Conversation

tunetheweb
Copy link
Member

@tunetheweb tunetheweb commented Jul 15, 2025

Fixes #639

INP attribution doesn't currently check if there are any event entries, whereas all the other metrics do.

This can result in an error when attempting to access the first entry.

This does require making each of the attribution fields optional (similar to CLS), but given this can only happen when it would error anyway I think that's OK without a major change.

@tunetheweb tunetheweb requested a review from philipwalton July 15, 2025 14:55
@philipwalton
Copy link
Member

philipwalton commented Jul 22, 2025

This can result in an error when attempting to access the first entry.

Can you clarify how it's possible for there to be an INP with no entries?

INP attribution doesn't currently check if there are any event entries, whereas all the other metrics do.

With all of the other metrics, it's possible for there to be a metric event with no entries:

  • CLS: when there are no layout shifts, so CLS is 0
  • LCP: after a bfcache restore, since there aren't LCP entries for that (yet)
  • FCP: after a bfcache restore
  • TTFB: after a bfcache restore

But these cases do not apply to INP. Is there another case I'm not aware of?

@tunetheweb
Copy link
Member Author

OK so it was do to a bug in my soft navs branch. I was resetting INP to 0 instead of -1 and so it was attempting to report that 0 (like it would CLS) but without any entries.

@tunetheweb tunetheweb closed this Jul 24, 2025
@tunetheweb tunetheweb deleted the guard-inp-attribution-no-entries branch July 24, 2025 10:57
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.

Cannot read properties of undefined (reading 'processingStart')
2 participants