Clean up feeds and listeners

This commit is contained in:
Jon Staab
2024-11-12 17:44:29 -08:00
parent 89a9d37379
commit 19ce6d1bad
8 changed files with 121 additions and 74 deletions
+1 -7
View File
@@ -4,7 +4,7 @@
import {WEEK, ctx, ago} from "@welshman/lib"
import {WRAP} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util"
import {pubkey, repository, subscribe} from "@welshman/app"
import {pubkey, repository} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Page from "@lib/components/Page.svelte"
import Button from "@lib/components/Button.svelte"
@@ -35,15 +35,9 @@
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
onMount(() => {
const sub = subscribe({
filters: [{kinds: [WRAP], "#p": [$pubkey!], since: ago(WEEK)}],
relays: ctx.app.router.UserInbox().getUrls(),
})
repository.on("update", onUpdate)
return () => {
sub.close()
repository.off("update", onUpdate)
}
})