This commit is contained in:
ammarahm-ed
2020-02-12 02:09:08 +05:00
parent 5608d8720c
commit 04af9e1668
3 changed files with 14 additions and 5 deletions

View File

@@ -28,9 +28,11 @@ export default class CachedCollection {
if (!item.id) throw new Error("The item must contain the id field.");
let exists = this.map.has(item.id);
await this.updateItem(item);
if (!exists) {
item.dateCreated = item.dateCreated || Date.now();
}
await this.updateItem(item);
if (!exists) {
await this.indexer.index(item.id);
}
}