Skip to content

Commit f11b552

Browse files
authored
fix(firestore): revert fix for undefined document snapshot data after "clear site data" (#9162)
This reverts #8871 because it had unexpected negative customer impacts (#9056) and caused CI failures.
1 parent 2b57312 commit f11b552

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

.changeset/heavy-ties-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Revert fix for issue where Firestore would produce `undefined` for document snapshot if "clear site data" button was pressed in the web browser. This fix was introduced in v11.6.1 but inadvertantly caused issues for some customers (https://github.com/firebase/firebase-js-sdk/issues/9056).

packages/firestore/src/local/simple_db.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export class SimpleDbTransaction {
160160
export class SimpleDb {
161161
private db?: IDBDatabase;
162162
private databaseDeletedListener?: DatabaseDeletedListener;
163-
private lastClosedDbVersion: number | null = null;
164163

165164
/** Deletes the specified database. */
166165
static delete(name: string): Promise<void> {
@@ -349,24 +348,6 @@ export class SimpleDb {
349348
event.oldVersion
350349
);
351350
const db = (event.target as IDBOpenDBRequest).result;
352-
if (
353-
this.lastClosedDbVersion !== null &&
354-
this.lastClosedDbVersion !== event.oldVersion
355-
) {
356-
// This thrown error will get passed to the `onerror` callback
357-
// registered above, and will then be propagated correctly.
358-
throw new Error(
359-
`refusing to open IndexedDB database due to potential ` +
360-
`corruption of the IndexedDB database data; this corruption ` +
361-
`could be caused by clicking the "clear site data" button in ` +
362-
`a web browser; try reloading the web page to re-initialize ` +
363-
`the IndexedDB database: ` +
364-
`lastClosedDbVersion=${this.lastClosedDbVersion}, ` +
365-
`event.oldVersion=${event.oldVersion}, ` +
366-
`event.newVersion=${event.newVersion}, ` +
367-
`db.version=${db.version}`
368-
);
369-
}
370351
this.schemaConverter
371352
.createOrUpgrade(
372353
db,
@@ -382,15 +363,6 @@ export class SimpleDb {
382363
});
383364
};
384365
});
385-
386-
this.db.addEventListener(
387-
'close',
388-
event => {
389-
const db = event.target as IDBDatabase;
390-
this.lastClosedDbVersion = db.version;
391-
},
392-
{ passive: true }
393-
);
394366
}
395367

396368
this.db.addEventListener(

0 commit comments

Comments
 (0)