-
Notifications
You must be signed in to change notification settings - Fork 444
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
Missing Cumulative Layout Shift (CLS) metric when batching multiple reports together in a single network request #500
Comments
Try updating your implementation to not use Note that all of the bugs that used to require |
Updated the README in #501. |
Thank you for your reply. We are currently utilizing the visibilitychange implementation exclusively to invoke the flushQueue() function. I believe this is due to both the visibilitychange event listener from src/lib/onHidden.ts for cls metrics and our js file utilizing the same event. The intriguing question would be: How can I ensure that the listener in src/lib/onHidden.ts is triggered before the one in the js file? |
I haven't noticed your issue when I was posting a very similar one here #502 |
This was exactly our problem. After switching to window.addEventListener, the CLS metric is now being collected on time. Thanks for your support! |
Hello everyone,
After upgrading the web-vital plugin from 3.5.2 to 4.1.1, we noticed a problem with the Cumulative Layout Shift (CLS) metric.
We are seeing a rapid decrease in about 99% of the CLS counts.
Our implementation is very similar to your recommendation batch-multiple-reports-together, so we report all available metrics when the page is in the background or unloaded (document.visibilityState === 'hidden').
But if we compare the file src/lib/onHidden.ts in versions (3.5.2 and 4.1.1), we can see that we used to use the pagehide or visibilitychange event (event.type === 'pagehide' || document.visibilityState === 'hidden') and now only the visibilitychange event.
Our current problem now is that the flushQueue() visibilitychange listener in js is called earlier than the visibilitychange listener from src/lib/onHidden.ts, and unfortunately it is too late to pass the cls metrics.
Is there a workaround to get all the Web Vitals metrics and then call the flushQueue() function?
Thanks in advance.
Vasili and Edu
The text was updated successfully, but these errors were encountered: