UBER-509: do not update list of unread right after reading (#3461)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-06-29 22:11:02 +05:00 committed by GitHub
parent d17918932b
commit 184f126b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@
let docs: DocUpdates[] = []
let filtered: DocUpdates[] = []
let loading = true
let previousFilter: 'all' | 'read' | 'unread' = filter
$: query.query(
notification.class.DocUpdates,
@ -55,10 +56,11 @@
if (filter === 'read') {
filtered = docs.filter((p) => !p.txes.some((p) => p.isNew) && p.txes.length > 0)
} else if (filter === 'unread') {
filtered = docs.filter((p) => p.txes.some((p) => p.isNew) && p.txes.length > 0)
if (previousFilter !== 'unread') filtered = docs.filter((p) => p.txes.some((p) => p.isNew) && p.txes.length > 0)
} else {
filtered = docs.filter((p) => p.txes.length > 0)
}
previousFilter = filter
listProvider.update(filtered)
if (_id === undefined) {
changeSelected(selected)