From eee1be1ceb5640d75288054c3730ebbdf7078a06 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 24 Jun 2021 16:16:15 +0200 Subject: [PATCH] =?UTF-8?q?safari=20doesn't=20like=20empty=20string=20key?= =?UTF-8?q?=20paths=20=F0=9F=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/matrix/storage/idb/schema.js | 4 ++-- src/matrix/storage/idb/stores/TimelineRelationStore.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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)); } }