fix(web): remove unload event listener to fix Chrome 146+ deprecation#924
Conversation
🦋 Changeset detectedLatest commit: a0eba9c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Based on the discussion in #912, I've removed the unload listeners entirely since navigator locks now handle tab detection. Happy to revert or adjust if more testing is needed before this is merged. |
6af1e0a to
1ced517
Compare
There was a problem hiding this comment.
I ran a quick manual test of these changes in the react supabase todolist demo app. Closing a tab providing the database for the sync worker still makes it retry with a different tab, so it looks like the unload listeners indeed aren't necessary anymore.
I'd like to wait for Steven to also take a look once he's back, in case he finds additional issues to look out for.
a4d3558 to
8f6dcf5
Compare
8f6dcf5 to
61c6d28
Compare
|
Thanks for your contribution! |
|
Thank you! Happy to contribute to PowerSync 🙌 |
Fixes #912
Based on maintainer feedback in #912, the
unloadevent listeners have been removed entirely rather than replaced withpagehide.pagehideis not appropriate here becauseclose()is a terminal action - if the tab is restored from bfcache, the database would remain closed.Since navigator locks now reliably handle tab detection, the
unloadlisteners are no longer needed.Changes in
packages/web/src/db/PowerSyncDatabase.ts:unloadListenerpropertywindow.addEventListener('unload', ...)block from constructorwindow.removeEventListener('unload', ...)block fromclose()