mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-12 18:19:12 +00:00
7b9b8d9876
ComposeView saves the draft only in onDisappear, which does not run when chatModel.chatId changes while ChatView stays presented - opening a group member's direct chat, a "forwarded from" chat, or a chat from a notification. The compose text was carried into the opened chat, and if the user could not send messages there (observer, channel subscriber, review by admins), the sendMsgEnabled change handler cleared it, losing the draft. The draft is now saved or cleared in ChatView's chatId change handler, mirroring onDisappear, before chat is replaced - ComposeView still renders the previous chat at that point, so its sendMsgEnabled handler fires only after the draft is safe, and clearCurrentDraft skips it because draftChatId no longer matches the opened chat. Skipped: secondary (member support) chat views, which share the group's chat id and would clobber the main chat's draft; forwarding compose state, which is prepared for the destination chat; drafts already prepared for the opened chat (shareChatLink); live messages and active voice recordings, which only ComposeView can complete.