Skip to content

Commit 48d5077

Browse files
committed
fixups
1 parent 4ed6691 commit 48d5077

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

packages/firestore/src/api/cache_config.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class MemoryLocalCacheImpl implements MemoryLocalCache {
3838
this._onlineComponentProvider = new OnlineComponentProvider();
3939
this._offlineComponentProvider = new MemoryOfflineComponentProvider();
4040
}
41+
42+
toJSON() {
43+
return { kind: this.kind };
44+
}
4145
}
4246

4347
export interface IndexedDbLocalCache {
@@ -54,15 +58,19 @@ class IndexedDbLocalCacheImpl implements IndexedDbLocalCache {
5458
constructor(settings: IndexedDbSettings | undefined) {
5559
let tabManager: IndexedDbTabManager;
5660
if (settings?.tabManager) {
57-
settings.tabManager.initialize(settings);
61+
settings.tabManager._initialize(settings);
5862
tabManager = settings.tabManager;
5963
} else {
6064
tabManager = indexedDbSingleTabManager(undefined);
61-
tabManager.initialize(settings);
65+
tabManager._initialize(settings);
6266
}
6367
this._onlineComponentProvider = tabManager._onlineComponentProvider!;
6468
this._offlineComponentProvider = tabManager._offlineComponentProvider!;
6569
}
70+
71+
toJSON() {
72+
return { kind: this.kind };
73+
}
6674
}
6775

6876
export type FirestoreLocalCache = MemoryLocalCache | IndexedDbLocalCache;
@@ -87,7 +95,7 @@ export function indexedDbLocalCache(
8795

8896
export interface IndexedDbSingleTabManager {
8997
kind: 'indexedDbSingleTab';
90-
initialize: (
98+
_initialize: (
9199
settings: Omit<IndexedDbSettings, 'tabManager'> | undefined
92100
) => void;
93101
_onlineComponentProvider?: OnlineComponentProvider;
@@ -102,7 +110,11 @@ class SingleTabManagerImpl implements IndexedDbSingleTabManager {
102110

103111
constructor(private forceOwnership?: boolean) {}
104112

105-
initialize(
113+
toJSON() {
114+
return { kind: this.kind };
115+
}
116+
117+
_initialize(
106118
settings: Omit<IndexedDbSettings, 'tabManager'> | undefined
107119
): void {
108120
this._onlineComponentProvider = new OnlineComponentProvider();
@@ -116,7 +128,7 @@ class SingleTabManagerImpl implements IndexedDbSingleTabManager {
116128

117129
export interface IndexedDbMultipleTabManager {
118130
kind: 'IndexedDbMultipleTab';
119-
initialize: (settings: Omit<IndexedDbSettings, 'tabManager'>) => void;
131+
_initialize: (settings: Omit<IndexedDbSettings, 'tabManager'>) => void;
120132
_onlineComponentProvider?: OnlineComponentProvider;
121133
_offlineComponentProvider?: OfflineComponentProvider;
122134
}
@@ -127,7 +139,11 @@ class MultiTabManagerImpl implements IndexedDbMultipleTabManager {
127139
_onlineComponentProvider?: OnlineComponentProvider;
128140
_offlineComponentProvider?: OfflineComponentProvider;
129141

130-
initialize(
142+
toJSON() {
143+
return { kind: this.kind };
144+
}
145+
146+
_initialize(
131147
settings: Omit<IndexedDbSettings, 'tabManager'> | undefined
132148
): void {
133149
this._onlineComponentProvider = new OnlineComponentProvider();

packages/firestore/src/core/firestore_client.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ export class FirestoreClient {
124124
private authCredentials: CredentialsProvider<User>,
125125
private appCheckCredentials: CredentialsProvider<string>,
126126
/**
127-
* Asynchronous queue responsible for all of our internal processing. When //
128-
* we get incoming work from the user (via public API) or the network //
129-
* (incoming GRPC messages), we should always schedule onto this queue. //
130-
* This ensures all of our work is properly serialized (e.g. we don't //
131-
* start processing a new operation while the previous one is waiting for //
132-
* an async I/O to complete). //
127+
* Asynchronous queue responsible for all of our internal processing. When
128+
* we get incoming work from the user (via public API) or the network
129+
* (incoming GRPC messages), we should always schedule onto this queue.
130+
* This ensures all of our work is properly serialized (e.g. we don't
131+
* start processing a new operation while the previous one is waiting for
132+
* an async I/O to complete).
133133
*/
134134
public asyncQueue: AsyncQueue,
135135
private databaseInfo: DatabaseInfo

packages/firestore/src/lite-api/settings.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ export class FirestoreSettingsImpl {
110110

111111
this.credentials = settings.credentials;
112112
this.ignoreUndefinedProperties = !!settings.ignoreUndefinedProperties;
113-
logWarn(
114-
`Setting offline cache to ${JSON.stringify(
115-
settings
116-
)} from PrivateSettings`
117-
);
113+
// logWarn(
114+
// `Setting offline cache to ${JSON.stringify(
115+
// settings.cache
116+
// )} from PrivateSettings`
117+
// );
118118
this.cache = settings.cache;
119119

120120
if (settings.cacheSizeBytes === undefined) {

packages/firestore/test/integration/api_internal/idle_timeout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { apiDescribe, withTestDb } from '../util/helpers';
2222
import { asyncQueue } from '../util/internal_helpers';
2323

2424
apiDescribe('Idle Timeout', (persistence: boolean) => {
25-
it('can write document after idle timeout', () => {
25+
it.only('can write document after idle timeout', () => {
2626
return withTestDb(persistence, db => {
2727
const docRef = doc(collection(db, 'test-collection'));
2828
return setDoc(docRef, { foo: 'bar' })

packages/firestore/test/integration/util/helpers.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
import { isIndexedDBAvailable } from '@firebase/util';
1919

20-
import { indexedDbLocalCache } from '../../../src/api/cache_config';
20+
import {
21+
indexedDbLocalCache,
22+
memoryLocalCache
23+
} from '../../../src/api/cache_config';
2124
import { logWarn } from '../../../src/util/log';
2225

2326
import {
@@ -187,7 +190,7 @@ export async function withTestDbsSettings(
187190
const dbs: Firestore[] = [];
188191

189192
for (let i = 0; i < numDbs; i++) {
190-
logWarn(`set persistence from helper: ${persistence}`);
193+
// logWarn(`set persistence from helper: ${persistence}`);
191194
if (persistence) {
192195
settings.cache = indexedDbLocalCache();
193196
}

0 commit comments

Comments
 (0)