Replace items with unread on background sync
This commit is contained in:
parent
761b4f05fd
commit
47c72d0029
@ -418,12 +418,21 @@
|
|||||||
fetch(`/api/unread`)
|
fetch(`/api/unread`)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(items => {
|
.then(items => {
|
||||||
|
if (!this.showRead) {
|
||||||
|
if (!items.some(i => i.ID == this.selectedItem)) {
|
||||||
|
items.unshift(this.items.find(i => i.ID == this.selectedItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.items = items;
|
||||||
|
} else {
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
if (!this.items.some(i => i.ID == item.ID)) {
|
if (!this.items.some(i => i.ID == item.ID)) {
|
||||||
this.items.unshift(item);
|
this.items.unshift(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setPageTitle();
|
this.setPageTitle();
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}, 5 * 60 * 1000);
|
}, 5 * 60 * 1000);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user