js-client-sdk icon indicating copy to clipboard operation
js-client-sdk copied to clipboard

Lighthouse audit fails with `no-unload-listeners`

Open mkallies opened this issue 2 years ago • 5 comments

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.

mkallies avatar May 03 '22 13:05 mkallies

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 avatar May 03 '22 21:05 kinyoklion

@kinyoklion any updates on this? Another point to add is using launchdarkly + lighthouse-ci added 5 minutes to the run time. Not sure why

mkallies avatar Aug 30 '22 20:08 mkallies

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

kinyoklion avatar Aug 30 '22 21:08 kinyoklion

Hello, any news on this one?

alanayoub avatar Jan 18 '23 10:01 alanayoub

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

kinyoklion avatar Jan 18 '23 23:01 kinyoklion