-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: preserve navigation functionality when unload
event is deprecated
#29525
fix: preserve navigation functionality when unload
event is deprecated
#29525
Conversation
unload
event is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cacieprins I'm not sure I would even advocate for exposing page:show
and page:hide
until users directly ask for it.
Shouldn't we update the onUpload
callback to onPageHide
?
1 flaky test on run #55532 ↗︎
Details:
cypress/e2e/commands/querying/querying.cy.js • 1 flaky test • 5x-driver-chrome:beta
Review all test suite changes for PR #29525 ↗︎ |
@@ -344,7 +344,9 @@ export class EventManager { | |||
// when we actually unload then | |||
// nuke all of the cookies again | |||
// so we clear out unload | |||
$window.on('unload', () => { | |||
const unloadEvent = this.isBrowser({ family: 'chromium' }) ? 'pagehide' : 'unload' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cacieprins Can you add a note about why we decided to only target chromium here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in a64d262
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
unload
event deprecation within Chrome #29241Additional details
In order to prepare for Chrome's removal of the
unload
event, we are migrating to usingpagehide
as a proxy for internal navigation detection. In order to preservewindow:unload
, for now, this event is also triggered onpagehide
. Because the event emitted onpagehide
is a superset ofEvent
, which is emitted onunload
, this is not a breaking change.Future steps to support deprecation of
unload
:window:pageshow
andwindow:pagehide
eventswindow:unload
is usedSteps to test
Existing tests should pass with the flags removed. To test full
unload
removal, uncomment the indicated flags inpackages/server/lib/util/chromium_flags.ts
.How has the user experience changed?
window:unload
may fire both more reliably and at a slightly different point in the page lifecycle timeline. Otherwise, it should not be impacted.PR Tasks
cypress-documentation
?type definitions
?