Space search

This commit is contained in:
Ben
2026-02-14 21:27:36 -05:00
committed by Jon Staab
parent 7823e1d803
commit 66a7a2a7af
4 changed files with 627 additions and 34 deletions
+47
View File
@@ -131,8 +131,55 @@ export const makeFeed = ({
insertEvent(event)
}
const reveal = (id: string, targetEvent?: TrustedEvent) => {
const current = get(events)
if (current.find(e => e.id === id)) {
return true
}
const queued = get(buffer)
const index = queued.findIndex(e => e.id === id)
if (index === -1) {
const event = targetEvent || repository.getEvent(id)
if (event && matchFilters(filters, event)) {
insertEvent(event)
const next = get(events)
if (next.find(e => e.id === id)) {
return true
}
const queuedNext = get(buffer)
const queuedIndex = queuedNext.findIndex(e => e.id === id)
if (queuedIndex > -1) {
const count = Math.max(30, queuedIndex + 1)
const chunk = queuedNext.splice(0, count)
events.update($events => [...$events, ...chunk])
return true
}
}
return false
}
const count = Math.max(30, index + 1)
const chunk = queued.splice(0, count)
events.update($events => [...$events, ...chunk])
return true
}
return {
events,
reveal,
cleanup: () => {
scroller.stop()
controller.abort()