Fix channel loading

This commit is contained in:
Jon Staab
2024-10-17 09:44:06 -07:00
parent 8ce79193d1
commit 1055a6d567
6 changed files with 27 additions and 37 deletions
+10 -10
View File
@@ -25,12 +25,10 @@
onMount(() => {
const filter = {kinds: [WRAP], "#p": [$pubkey!]}
const sub = subscribe({filters: [{...filter, since: ago(30)}]})
const relays = ctx.app.router.InboxRelays().getUrls()
const sub = subscribe({filters: [{...filter, since: ago(30)}], relays})
pullConservatively({
filters: [filter],
relays: ctx.app.router.InboxRelays().getUrls(),
})
pullConservatively({filters: [filter], relays})
return () => sub.close()
})
@@ -68,11 +66,13 @@
<Icon icon="magnifer" />
<input bind:value={term} class="grow" type="text" />
</label>
<div class="overflow-auto">
{#each chats as { id, pubkeys, messages } (id)}
<ChatItem {id} {pubkeys} {messages} />
{/each}
</div>
{#key $page.params.chat}
<div class="overflow-auto">
{#each chats as { id, pubkeys, messages } (id)}
<ChatItem {id} {pubkeys} {messages} />
{/each}
</div>
{/key}
</SecondaryNav>
<Page>
+3 -5
View File
@@ -11,7 +11,7 @@
import {onMount} from "svelte"
import {page} from "$app/stores"
import {derived} from "svelte/store"
import {sortBy, remove} from "@welshman/lib"
import {ctx, sortBy, now, remove} from "@welshman/lib"
import type {TrustedEvent, EventContent} from "@welshman/util"
import {createEvent, DIRECT_MESSAGE} from "@welshman/util"
import {
@@ -91,10 +91,8 @@
elements.reverse()
}
onMount(() => {
for (const pk of others) {
loadInboxRelaySelections(pk)
}
onMount(async () => {
await Promise.all(others.map(pk => loadInboxRelaySelections(pk)))
})
setTimeout(() => {
@@ -25,7 +25,6 @@
import ChannelMessage from "@app/components/ChannelMessage.svelte"
import ChannelCompose from "@app/components/ChannelCompose.svelte"
import {
loadChannel,
userMembership,
decodeNRelay,
makeChannelId,
@@ -39,8 +38,7 @@
const {nrelay, room = GENERAL} = $page.params
const url = decodeNRelay(nrelay)
const id = makeChannelId(url, room)
const channel = deriveChannel(id)
const channel = deriveChannel(makeChannelId(url, room))
const thunks = writable({} as Record<string, Thunk>)
const assertEvent = (e: any) => e as TrustedEvent
@@ -84,7 +82,6 @@
}
onMount(() => {
loadChannel(id)
subscribe({filters: [{'#~': [room], since: now()}], relays: [url]})
})