-
Notifications
You must be signed in to change notification settings - Fork 420
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
INP Loses Target Element After SPA Route Change #567
Comments
Can you create an example to show the issue here? Chrome does increment interactionids by 7 but FID should be the first interactionId for the page, so odd that it's later. |
I described how to reproduce the problem above. To do this, you need to create a SPA application (I used Vite + React). I generate the INP metric via select with a shift of the block DOM element.
Result :
Why do I think this is a bug: the if we assume that the event that occurred is correctly wiped by |
The problem is reproduced periodically, but steadily. |
I do not use Vite nor React. Can you point me to an existing MVP app that demonstrates the issue? |
I can create the MVP app and give you a link to clone the repo or if you have better idea Im ready to do. |
That works. I'm sure I could figure it out myself, but I always find it's best not to make assumptions and get an exact repro in case |I do something slightly different. |
No problem. I'm glad to help. It happens in several applications. I can't share the private repo, that I work for. But I reproduce the problem for almost default vite + react project. I prepared the repo link to clone Added description to README |
OK the issue is as follows:
If 1 is longer than 2 then you will get a target. On a fast machine they both take similar times (I'm seeing 32ms or 40ms) so they are similar but on occasion one is faster than the other. And depending which is faster you will see the intermittently. If you made the button take longer with some blocking work, then you would consistently see the target. As noted in #477 this saving of the target is not perfect and "will not help if the element is removed before the first event entry from that interactionId is reported so is not a full solution, but will help in some cases". So to solve this we need a similar fix in the spec and then in Chrome as the library cannot do anything further than this. TLDR this is a duplicate of #335 but the library is limited to what it can do here so we're waiting on the fix in Event Timing spec and Chrome to make further process here. |
How to reproduce
Not always, but systematically, there is a loss of the target element and selector. At the same time,
firstEntryWithTarget?.target == undefined
andinteractionTargetMap
contains an element byinteractionId
, butfirstEntry.interactionId
differs from the one saved ininteractionTargetMap
and is always greater than it by7
The text was updated successfully, but these errors were encountered: