Skip to content

Commit 33d123b

Browse files
authored
Merge 8c4e191 into cc7207e
2 parents cc7207e + 8c4e191 commit 33d123b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/firestore/src/local/indexeddb_persistence.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ export class IndexedDbPersistence implements Persistence {
966966
return this.shutdown();
967967
});
968968
};
969-
this.window.addEventListener('unload', this.windowUnloadHandler);
969+
this.window.addEventListener('pagehide', this.windowUnloadHandler);
970970
}
971971
}
972972

@@ -976,7 +976,7 @@ export class IndexedDbPersistence implements Persistence {
976976
typeof this.window?.removeEventListener === 'function',
977977
"Expected 'window.removeEventListener' to be a function"
978978
);
979-
this.window!.removeEventListener('unload', this.windowUnloadHandler);
979+
this.window!.removeEventListener('pagehide', this.windowUnloadHandler);
980980
this.windowUnloadHandler = null;
981981
}
982982
}

packages/firestore/src/local/shared_client_state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ export class WebStorageSharedClientState implements SharedClientState {
613613

614614
// Register a window unload hook to remove the client metadata entry from
615615
// WebStorage even if `shutdown()` was not called.
616-
this.window.addEventListener('unload', () => this.shutdown());
616+
this.window.addEventListener('pagehide', () => this.shutdown());
617617

618618
this.started = true;
619619
}

0 commit comments

Comments
 (0)