js-client-sdk
js-client-sdk copied to clipboard
Lighthouse audit fails with `no-unload-listeners`
Is your feature request related to a problem? Please describe.
We recently installed the React SDK. We run lighthouse-ci in our CI pipeline and it failed due to no-unload-listeners
.
Describe the solution you'd like
Based off of https://web.dev/bfcache/#never-use-the-unload-event, pagehide
event is the recommended event since it's triggered in all cases where unload
is triggered.
Describe alternatives you've considered For the time being we can ignore this error.
Additional context
Never add an unload event listener! Use the pagehide event instead. Adding an unload event listener will make your site slower in Firefox, and the code won't even run most of the time in Chrome and Safari.
Hello @mkallies
Thank you for the report! We are aware of the issue with the bfcache and will be working on a solution soon.
filed internally as 147957
Thank you, Ryan
@kinyoklion any updates on this? Another point to add is using launchdarkly + lighthouse-ci added 5 minutes to the run time. Not sure why
Hey @mkallies,
I can't commit to a release date, but I can say that we have been working on this. Unfortunately there is a lot of inconsistency between browsers. So, the implementation itself isn't so much a problem, but validation is more complex.
Thanks, Ryan
Hello, any news on this one?
Hey @mkallies, @alanayoub,
This has been released in 3.1.0: https://github.com/launchdarkly/js-client-sdk/releases/tag/3.1.0
We were able to validate the behavior recently and it should behave more consistently than the previous implementation.
Thanks for the patience.
Thank you, Ryan