Skip to content
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

Use 'pagehide' for page termination by default. #4886

Merged
merged 6 commits into from
May 13, 2021

Conversation

wu-hui
Copy link
Contributor

@wu-hui wu-hui commented May 10, 2021

@changeset-bot
Copy link

changeset-bot bot commented May 10, 2021

🦋 Changeset detected

Latest commit: f5584da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/firestore Patch
firebase Patch
@firebase/rules-unit-testing Patch

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 10, 2021

Size Analysis Report

Affected Products

Diffs between base commit (6e35e53) and head commit (33d123b) are too large (479,509 characters) to display.

Please check below links to see details from the original test log.

* if available, it falls back to the less reliable 'unload'.
*/
export function terminationEvent(window: WindowLike | null): string {
return 'onpagehide' in window! ? 'pagehide' : 'unload';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just use "pagehide" and do not need to fall back: https://caniuse.com/page-transition-events

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui May 11, 2021
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add changeset.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui May 11, 2021
@wu-hui wu-hui merged commit 96a4709 into master May 13, 2021
@wu-hui wu-hui deleted the wuandy/WiserPageTermination branch May 13, 2021 15:38
@google-oss-bot google-oss-bot mentioned this pull request May 18, 2021
@@ -58,7 +58,7 @@ export class FakeWindow implements WindowLike {
case 'storage':
this.storageListeners.push(listener);
break;
case 'unload':
case 'pagehide':
case 'visibilitychange':
// The spec tests currently do not rely on `unload`/`visibilitychange`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Looks like this comment refers to the old ‘unload’ rather than ‘pagehide’

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. WIll fix soon.

@firebase firebase locked and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Firestore] Registering an unload listener and best practices
4 participants