Fix undefined chat draft key

This commit is contained in:
Jon Staab
2026-05-06 16:56:31 -07:00
parent 3833cb093d
commit 8f56812dd1
2 changed files with 5 additions and 8 deletions
+4 -3
View File
@@ -53,7 +53,7 @@
import ChatComposeEdit from "@app/components/ChatComposeEdit.svelte"
import ChatComposeParent from "@app/components/ChatComposeParent.svelte"
import ThunkToast from "@app/components/ThunkToast.svelte"
import {userSettingsValues, deriveChat} from "@app/core/state"
import {userSettingsValues, deriveChat, makeChatId} from "@app/core/state"
import {pushModal} from "@app/util/modal"
import {DraftKey} from "@app/util/drafts"
import {makeDelete, prependParent} from "@app/core/commands"
@@ -66,8 +66,9 @@
const {pubkeys, info}: Props = $props()
const chat = deriveChat(pubkeys)
const draftKey = new DraftKey<{content?: string | object}>(`dm:${$chat?.id}`)
const chatId = makeChatId(pubkeys)
const chat = deriveChat(chatId)
const draftKey = new DraftKey<{content?: string | object}>(`dm:${chatId}`)
const others = remove($pubkey!, pubkeys)
const missingRelayLists = $derived(others.filter(pk => !$messagingRelayListsByPubkey.has(pk)))
+1 -5
View File
@@ -560,11 +560,7 @@ export const chatsById = call(() => {
})
})
export const deriveChat = call(() => {
const _deriveChat = makeDeriveItem(chatsById)
return (pubkeys: string[]) => _deriveChat(makeChatId(pubkeys))
})
export const deriveChat = makeDeriveItem(chatsById)
export const chatSearch = derived(throttled(1500, chatsById), $chatsByPubkey => {
return createSearch(