feat: persist composer drafts in memory across navigation

This commit is contained in:
2026-04-04 16:52:22 +05:45
parent 70e5172f1b
commit c84cdc076d
12 changed files with 257 additions and 55 deletions
+3
View File
@@ -55,6 +55,7 @@
import ThunkToast from "@app/components/ThunkToast.svelte"
import {userSettingsValues, deriveChat} from "@app/core/state"
import {pushModal} from "@app/util/modal"
import {DraftKey} from "@app/util/drafts"
import {makeDelete, prependParent} from "@app/core/commands"
import {pushToast} from "@app/util/toast"
@@ -66,6 +67,7 @@
const {pubkeys, info}: Props = $props()
const chat = deriveChat(pubkeys)
const draftKey = new DraftKey<{content?: unknown}>(`dm:${$chat?.id}`)
const others = remove($pubkey!, pubkeys)
const missingRelayLists = $derived(others.filter(pk => !$messagingRelayListsByPubkey.has(pk)))
@@ -337,6 +339,7 @@
{onEscape}
{onEditPrevious}
content={eventToEdit?.content}
draftKey={eventToEdit ? undefined : draftKey}
disabled={Boolean(missingRelayLists.length)} />
{/key}
</div>