aohua / redux-state-sync

A lightweight middleware to sync your redux state across browser tabs
MIT License
235 stars 28 forks source link

Lighthouse audit fails with `no-unload-listeners` #170

Open alanayoub opened 1 year ago

alanayoub commented 1 year ago

Is your feature request related to a problem? Please describe. Lighthouse errors 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.

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.