diff --git a/src/matrix/storage/idb/schema.js b/src/matrix/storage/idb/schema.js index 256b6732..352c810c 100644 --- a/src/matrix/storage/idb/schema.js +++ b/src/matrix/storage/idb/schema.js @@ -140,5 +140,5 @@ async function migrateOperationScopeIndex(db, txn) { //v10 function createTimelineRelationsStore(db) { - db.createObjectStore("timelineRelations", {keyPath: ""}); -} \ No newline at end of file + db.createObjectStore("timelineRelations", {keyPath: "key"}); +} diff --git a/src/matrix/storage/idb/stores/TimelineRelationStore.js b/src/matrix/storage/idb/stores/TimelineRelationStore.js index 013fb2d6..bba24fc3 100644 --- a/src/matrix/storage/idb/stores/TimelineRelationStore.js +++ b/src/matrix/storage/idb/stores/TimelineRelationStore.js @@ -30,7 +30,7 @@ export class TimelineRelationStore { } add(roomId, targetEventId, relType, sourceEventId) { - return this._store.add(encodeKey(roomId, targetEventId, relType, sourceEventId)); + return this._store.add({key: encodeKey(roomId, targetEventId, relType, sourceEventId)}); } remove(roomId, targetEventId, relType, sourceEventId) { @@ -56,8 +56,8 @@ export class TimelineRelationStore { true, true ); - const keys = await this._store.selectAll(range); - return keys.map(decodeKey); + const items = await this._store.selectAll(range); + return items.map(i => decodeKey(i.key)); } async getAllForTarget(roomId, targetId) { @@ -69,7 +69,7 @@ export class TimelineRelationStore { true, true ); - const keys = await this._store.selectAll(range); - return keys.map(decodeKey); + const items = await this._store.selectAll(range); + return items.map(i => decodeKey(i.key)); } }