Avoid bug

This commit is contained in:
Jon Staab 2024-08-22 09:47:26 -07:00
parent 3b7f08f84b
commit 7a51bfa0c6

View File

@ -785,6 +785,10 @@ export const markAsSeen = async (kind: number, eventsByKey: Record<string, Trust
const tags = Array.isArray(rawTags) ? rawTags.filter(t => !eventsByKey[t[1]]) : [] const tags = Array.isArray(rawTags) ? rawTags.filter(t => !eventsByKey[t[1]]) : []
for (const [key, events] of Object.entries(eventsByKey)) { for (const [key, events] of Object.entries(eventsByKey)) {
if (events.length === 0) {
continue
}
const [newer, older] = splitAt(10, events) const [newer, older] = splitAt(10, events)
const ts = first(older)?.created_at || last(newer).created_at - seconds(3, "hour") const ts = first(older)?.created_at || last(newer).created_at - seconds(3, "hour")