mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-30 04:39:00 +01:00
Properly handle cleared ref after unmount
This commit is contained in:
parent
810f2bdd65
commit
2e156d7ef4
@ -29,10 +29,10 @@ const useDraft = (
|
||||
|
||||
const updateDraft = useCallback((draftChatId: string, draftThreadId: number) => {
|
||||
const currentHtml = htmlRef.current;
|
||||
if (editedMessage) return;
|
||||
if (currentHtml === undefined || editedMessage) return;
|
||||
if (currentHtml.length) {
|
||||
saveDraft({ chatId: draftChatId, threadId: draftThreadId, draft: parseMessageInput(currentHtml!) });
|
||||
} else if (currentHtml !== undefined) {
|
||||
} else {
|
||||
clearDraft({ chatId: draftChatId, threadId: draftThreadId });
|
||||
}
|
||||
}, [clearDraft, editedMessage, htmlRef, saveDraft]);
|
||||
|
Loading…
Reference in New Issue
Block a user