Skip to content

Add experimentalForceOwningTab for Web Worker support #2197

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

Merged
merged 33 commits into from
Jun 1, 2020
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f0287d4
cleaned up
Sep 26, 2019
15cf32e
fix tests
Sep 27, 2019
66655d0
remove comments
Sep 27, 2019
9ac6e2d
fix michael comments
Sep 30, 2019
d813905
Merge branch 'master' into bc/ww-persist
Oct 21, 2019
347b722
Merge branch 'master' into bc/ww-persist
Nov 12, 2019
91404e3
[AUTOMATED]: Prettier Code Styling
Nov 12, 2019
00c6dc7
Merge branch 'release' into bc/ww-persist
Nov 14, 2019
6dc5e51
Merge branch 'master' into bc/ww-persist
Dec 10, 2019
fef8971
Merge branch 'master' into bc/ww-persist
Feb 13, 2020
8366646
Merge branch 'master' into bc/ww-persist
May 7, 2020
741e88e
update post API council
May 7, 2020
86ca4aa
[AUTOMATED]: Prettier Code Styling
May 7, 2020
16479d4
[AUTOMATED]: License Headers
May 7, 2020
0784827
Merge branch 'master' into bc/ww-persist
May 7, 2020
59d07ee
update error message for primary lease unavailability
May 8, 2020
5dae5b6
Merge branch 'master' into bc/ww-persist
May 13, 2020
71785f2
add changelog
May 13, 2020
ca02909
Merge branch 'master' into bc/ww-persist
May 13, 2020
c5f491a
Merge branch 'master' into bc/ww-persist
May 13, 2020
08f8fb9
resolve comments
May 13, 2020
398c330
Merge branch 'master' into bc/ww-persist
May 18, 2020
6b6db57
Merge branch 'master' into bc/ww-persist
May 18, 2020
b178a75
resolve comments and post-merge issues
May 18, 2020
7d8e41a
update isAvailable() logic + comments round3
May 20, 2020
6d20b20
add forceOwningTab logic back to canActAsPrimary, remove from updateC…
May 21, 2020
016aed8
update forceOwningTab comment
May 27, 2020
31a8772
move forceOwningTab logic up in canActAsPrimary
May 27, 2020
c7cbf9a
Merge branch 'master' into bc/ww-persist
May 28, 2020
be3a0d4
update new test from master
May 28, 2020
47cd1f6
Merge branch 'master' into bc/ww-persist
May 28, 2020
0f45287
s/'true'/
Jun 1, 2020
9cfe34d
remove project.json
Jun 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/firestore/src/local/indexeddb_persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ export class IndexedDbPersistence implements Persistence {
private canActAsPrimary(
txn: PersistenceTransaction
): PersistencePromise<boolean> {
if (this.forceOwningTab) {
return PersistencePromise.resolve<boolean>(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably drop the generic since it can be inferred.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure why TS can't infer it, but the error I get is:
Type 'PersistencePromise<true>' is not assignable to type 'PersistencePromise<boolean>'.

}
const store = primaryClientStore(txn);
return store
.get(DbPrimaryClient.key)
Expand Down Expand Up @@ -612,9 +615,6 @@ export class IndexedDbPersistence implements Persistence {
}

if (!this.isLocalClient(currentPrimary)) {
if (this.forceOwningTab) {
return true;
}
if (!currentPrimary!.allowTabSynchronization) {
// Fail the `canActAsPrimary` check if the current leaseholder has
// not opted into multi-tab synchronization. If this happens at
Expand Down