feat: add space search to recent activity page (#59) #119

Merged
hodlbod merged 5 commits from :feature/59-space-search into dev 2026-04-03 16:58:35 +00:00
Showing only changes of commit 99dfd854ca - Show all commits
+5 -14
View File
1
@@ -114,7 +114,6 @@
let loading = $state(false)
let searchResults: TrustedEvent[] = $state([])
let searchInput: HTMLInputElement | undefined = $state()
let currentSearchId = 0
let controller: AbortController | undefined
let limit = $state(20)
@@ -157,7 +156,7 @@
controller = undefined
}
const search = debounce(300, async (searchTerm: string, searchId: number) => {
const search = debounce(300, async (searchTerm: string) => {
controller?.abort()
if (!searchTerm.trim()) {
@@ -177,27 +176,19 @@
filters: [{kinds: [MESSAGE, ...CONTENT_KINDS], search: searchTerm.trim()}],
})
if (searchId === currentSearchId) {
searchResults = sortEventsDesc(uniqBy((e: TrustedEvent) => e.id, events))
}
searchResults = sortEventsDesc(uniqBy((e: TrustedEvent) => e.id, events))
hodlbod marked this conversation as resolved Outdated
Outdated
Review

Take a look at how the room search works — we should add a search icon to the PageBar which shows the same kind of popover/dialog when clicked.

Take a look at how the room search works — we should add a search icon to the PageBar which shows the same kind of popover/dialog when clicked.
} catch (error) {
if (
!(error instanceof DOMException && error.name === "AbortError") &&
searchId === currentSearchId
) {
if (!(error instanceof DOMException && error.name === "AbortError")) {
searchResults = []
Review

searchId/currentSearchId are redundant with AbortController, they can be removed

searchId/currentSearchId are redundant with AbortController, they can be removed
}
} finally {
if (searchId === currentSearchId) {
loading = false
}
loading = false
}
})
const onInput = () => {
showSearch = true
currentSearchId += 1
void search(term, currentSearchId)
void search(term)
}
const onResultClick = (event: TrustedEvent) => {