Fix undefined chat draft key
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
import ChatComposeEdit from "@app/components/ChatComposeEdit.svelte"
|
import ChatComposeEdit from "@app/components/ChatComposeEdit.svelte"
|
||||||
import ChatComposeParent from "@app/components/ChatComposeParent.svelte"
|
import ChatComposeParent from "@app/components/ChatComposeParent.svelte"
|
||||||
import ThunkToast from "@app/components/ThunkToast.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 {pushModal} from "@app/util/modal"
|
||||||
import {DraftKey} from "@app/util/drafts"
|
import {DraftKey} from "@app/util/drafts"
|
||||||
import {makeDelete, prependParent} from "@app/core/commands"
|
import {makeDelete, prependParent} from "@app/core/commands"
|
||||||
@@ -66,8 +66,9 @@
|
|||||||
|
|
||||||
const {pubkeys, info}: Props = $props()
|
const {pubkeys, info}: Props = $props()
|
||||||
|
|
||||||
const chat = deriveChat(pubkeys)
|
const chatId = makeChatId(pubkeys)
|
||||||
const draftKey = new DraftKey<{content?: string | object}>(`dm:${$chat?.id}`)
|
const chat = deriveChat(chatId)
|
||||||
|
const draftKey = new DraftKey<{content?: string | object}>(`dm:${chatId}`)
|
||||||
const others = remove($pubkey!, pubkeys)
|
const others = remove($pubkey!, pubkeys)
|
||||||
const missingRelayLists = $derived(others.filter(pk => !$messagingRelayListsByPubkey.has(pk)))
|
const missingRelayLists = $derived(others.filter(pk => !$messagingRelayListsByPubkey.has(pk)))
|
||||||
|
|
||||||
|
|||||||
@@ -560,11 +560,7 @@ export const chatsById = call(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
export const deriveChat = call(() => {
|
export const deriveChat = makeDeriveItem(chatsById)
|
||||||
const _deriveChat = makeDeriveItem(chatsById)
|
|
||||||
|
|
||||||
return (pubkeys: string[]) => _deriveChat(makeChatId(pubkeys))
|
|
||||||
})
|
|
||||||
|
|
||||||
export const chatSearch = derived(throttled(1500, chatsById), $chatsByPubkey => {
|
export const chatSearch = derived(throttled(1500, chatsById), $chatsByPubkey => {
|
||||||
return createSearch(
|
return createSearch(
|
||||||
|
|||||||
Reference in New Issue
Block a user