-only store key if necessary
This commit is contained in:
parent
d19aef746c
commit
53613a137d
@ -2772,8 +2772,10 @@ export const walletMetadataStore = {
|
|||||||
export interface DbDumpRecord {
|
export interface DbDumpRecord {
|
||||||
/**
|
/**
|
||||||
* Key, serialized with structuredEncapsulated.
|
* Key, serialized with structuredEncapsulated.
|
||||||
|
*
|
||||||
|
* Only present for out-of-line keys (i.e. no key path).
|
||||||
*/
|
*/
|
||||||
key: any;
|
key?: any;
|
||||||
/**
|
/**
|
||||||
* Value, serialized with structuredEncapsulated.
|
* Value, serialized with structuredEncapsulated.
|
||||||
*/
|
*/
|
||||||
@ -2844,10 +2846,15 @@ export function exportDb(db: IDBDatabase): Promise<DbDump> {
|
|||||||
store.openCursor().addEventListener("success", (e: Event) => {
|
store.openCursor().addEventListener("success", (e: Event) => {
|
||||||
const cursor = (e.target as any).result;
|
const cursor = (e.target as any).result;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
storeDump.records.push({
|
const rec: DbDumpRecord = {
|
||||||
key: structuredEncapsulate(cursor.key),
|
|
||||||
value: structuredEncapsulate(cursor.value),
|
value: structuredEncapsulate(cursor.value),
|
||||||
});
|
};
|
||||||
|
// Only store key if necessary, i.e. when
|
||||||
|
// the key is not stored as part of the object via
|
||||||
|
// a key path.
|
||||||
|
if (store.keyPath == null) {
|
||||||
|
rec.key = structuredEncapsulate(cursor.key);
|
||||||
|
}
|
||||||
cursor.continue();
|
cursor.continue();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user