Update CLS to max session window 5s cap 1s gap #148
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #136. This PR updates the implementation of CLS to use new definition outlined in the post Evolving CLS—a max session window with 5-second max and 1-second gap.
The only observable difference developers might notice to the API is previously the
metric.entries
array would only ever add new entries as additional shifts occurred on the page. With this change, only the entries from the max session window are reported, which means it could be the case the some of the entries referenced when CLS is first reported (e.g. after the tab is backgrounded), may not be the entries that are referenced the next time the tab is backgrounded. Developers not referencing themetric.entries
array should not notice any differences other than a possible reduction in the value reported.