GoogleChrome / GoogleChrome/web-vitals

Allow to reset the INP calculation

Open
#448 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8.6k
Forks
530
Avg merge
3h 4m
Merged PRs (30d)
3

Description

Hi,

it would be awesome if the package would offer a `resetINP` function or something similar.

**Use case**
We would need this feature as we take a look at the "subpages" of SPAs as individual pages and would be highly interested in the individual INP values of them. Because of the way the entries are collected in `longestInteractionList` this of course is not really possible.

**Possible Solution**
I guess clearing `prevInteractionCount, prevInteractionCount, longestInteractionMap` in this new reset function should be enough? Or do I miss something here?

**Value**
This clear function would allow for more different use cases (in combination with the already present `reportAllChanges: true`) while increasing the complexity and package size only slightly. I think this is a valuable addition!
Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by tracing the INP calculation through longestInteractionList and the mentioned state variables prevInteractionCount and longestInteractionMap. Define what resetINP must clear for SPA subpage measurements, then verify that subsequent interactions produce independent INP values when reportAllChanges is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.