safari doesn't like empty string key paths 🙄

This commit is contained in:
Bruno Windels 2021-06-24 16:16:15 +02:00
parent bb6417dab9
commit eee1be1ceb
2 changed files with 7 additions and 7 deletions

View file

@ -140,5 +140,5 @@ async function migrateOperationScopeIndex(db, txn) {
//v10 //v10
function createTimelineRelationsStore(db) { function createTimelineRelationsStore(db) {
db.createObjectStore("timelineRelations", {keyPath: ""}); db.createObjectStore("timelineRelations", {keyPath: "key"});
} }

View file

@ -30,7 +30,7 @@ export class TimelineRelationStore {
} }
add(roomId, targetEventId, relType, sourceEventId) { 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) { remove(roomId, targetEventId, relType, sourceEventId) {
@ -56,8 +56,8 @@ export class TimelineRelationStore {
true, true,
true true
); );
const keys = await this._store.selectAll(range); const items = await this._store.selectAll(range);
return keys.map(decodeKey); return items.map(i => decodeKey(i.key));
} }
async getAllForTarget(roomId, targetId) { async getAllForTarget(roomId, targetId) {
@ -69,7 +69,7 @@ export class TimelineRelationStore {
true, true,
true true
); );
const keys = await this._store.selectAll(range); const items = await this._store.selectAll(range);
return keys.map(decodeKey); return items.map(i => decodeKey(i.key));
} }
} }