Skip to content

Commit 89dd970

Browse files
committed
Add changeset and formatting
1 parent 52688e6 commit 89dd970

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

.changeset/empty-falcons-sit.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@firebase/app': patch
3+
'@firebase/installations': patch
4+
'@firebase/installations-compat': patch
5+
'@firebase/messaging': patch
6+
'@firebase/util': minor
7+
---
8+
9+
Remove idb dependency and replace with our own code.

packages/messaging/src/internals/idb-manager.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@ const OBJECT_STORE_NAME = 'firebase-messaging-store';
2929
let dbPromise: Promise<DBWrapper> | null = null;
3030
function getDbPromise(): Promise<DBWrapper> {
3131
if (!dbPromise) {
32-
dbPromise = openDB(DATABASE_NAME, DATABASE_VERSION, (upgradeDb, oldVersion) => {
33-
// We don't use 'break' in this switch statement, the fall-through behavior is what we want,
34-
// because if there are multiple versions between the old version and the current version, we
35-
// want ALL the migrations that correspond to those versions to run, not only the last one.
36-
// eslint-disable-next-line default-case
37-
switch (oldVersion) {
38-
case 0:
39-
upgradeDb.createObjectStore(OBJECT_STORE_NAME);
32+
dbPromise = openDB(
33+
DATABASE_NAME,
34+
DATABASE_VERSION,
35+
(upgradeDb, oldVersion) => {
36+
// We don't use 'break' in this switch statement, the fall-through behavior is what we want,
37+
// because if there are multiple versions between the old version and the current version, we
38+
// want ALL the migrations that correspond to those versions to run, not only the last one.
39+
// eslint-disable-next-line default-case
40+
switch (oldVersion) {
41+
case 0:
42+
upgradeDb.createObjectStore(OBJECT_STORE_NAME);
43+
}
4044
}
41-
});
45+
);
4246
}
4347
return dbPromise;
4448
}
@@ -49,10 +53,10 @@ export async function dbGet(
4953
): Promise<TokenDetails | undefined> {
5054
const key = getKey(firebaseDependencies);
5155
const db = await getDbPromise();
52-
const tokenDetails = await db
56+
const tokenDetails = (await db
5357
.transaction(OBJECT_STORE_NAME)
5458
.objectStore(OBJECT_STORE_NAME)
55-
.get(key) as TokenDetails;
59+
.get(key)) as TokenDetails;
5660

5761
if (tokenDetails) {
5862
return tokenDetails;

packages/util/index.node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ export * from './src/formatters';
4141
export * from './src/compat';
4242
// This can't be used in Node but it will cause errors if libraries import
4343
// these methods and they aren't here.
44-
export * from './src/indexeddb';
44+
export * from './src/indexeddb';

packages/util/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ export * from './src/utf8';
3434
export * from './src/exponential_backoff';
3535
export * from './src/formatters';
3636
export * from './src/compat';
37-
export * from './src/indexeddb';
37+
export * from './src/indexeddb';

0 commit comments

Comments
 (0)