Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sending a message is often delayed, sometimes buggy #3586

Open
hpk42 opened this issue Dec 7, 2023 · 14 comments
Open

sending a message is often delayed, sometimes buggy #3586

hpk42 opened this issue Dec 7, 2023 · 14 comments
Labels
bug Something isn't working
Milestone

Comments

@hpk42
Copy link
Contributor

hpk42 commented Dec 7, 2023

am using a recent master of core and desktop.

when i hit "ctrl-enter" for sending -- half the time it delays for 2+ seconds and sometimes the draft-text does not go away even after the message is posted (see screenshot). It feels like something is blocking. Currently, i can't offer much help in debugging but at least wanted to raise it, anyway.

Screenshot from 2023-12-07 13-36-11

@Simon-Laux
Copy link
Member

maybe send me the log after it happened, maybe there is some error somewhere?

@WofWca
Copy link
Collaborator

WofWca commented Sep 16, 2024

This code is responsible for message sending and draft removal:

const sendMessagePromise = sendMessage(accountId, chatId, {
text: replaceColonsSafe(message),
file: draftState.file || undefined,
quotedMessageId:
draftState.quote?.kind === 'WithMessage'
? draftState.quote.messageId
: null,
viewtype: draftState.viewType,
})
/* clear it here to make sure the draft is cleared */
await BackendRemote.rpc.removeDraft(selectedAccountId(), chatId)
// /* update the state to reflect the removed draft */
window.__reloadDraft && window.__reloadDraft()

It calls __reloadDraft, which is where the input text is reset, I believe:

This also might have to do with other code, e.g. message list re-rendering and re-fetching being too slow.

@hpk42
Copy link
Contributor Author

hpk42 commented Sep 19, 2024

Can't comment on the code but the issues still appears often for me -- on desktop i now take care especially in group chats, to very carefully check if the message went out, even if the input field continues to have the full draft message. I then need to remove it manually.

@WofWca
Copy link
Collaborator

WofWca commented Sep 20, 2024

Is it bad on all your Delta Chat accounts?

@hpk42
Copy link
Contributor Author

hpk42 commented Sep 20, 2024 via email

@WofWca
Copy link
Collaborator

WofWca commented Sep 24, 2024

@Simon-Laux could you explain what's the point of __reloadDraft() instead of clearDraft() #2529 ?

@Simon-Laux
Copy link
Member

Simon-Laux commented Sep 25, 2024

@Simon-Laux could you explain what's the point of __reloadDraft() instead of clearDraft() #2529 ?

to show the actual state of the draft in core. maybe could make sense to pass a chatId as argument there to make sure it is never called incorrectly while switching chats?

@WofWca
Copy link
Collaborator

WofWca commented Sep 25, 2024

But I mean, can it so happen that there is gonna be a draft after sending a message? Why make an async call. Would clearDraft() + __reloadDraft() make sense at least?

@WofWca
Copy link
Collaborator

WofWca commented Nov 4, 2024

@hpk42 A fix for a related issue (deltachat/deltachat-core-rust#6036) has been released with Delta Chat Dekstop 1.47.1. Please report whether things improved.

@hpk42
Copy link
Contributor Author

hpk42 commented Nov 4, 2024

K, i'll close and will re-open or open a new issue if it re-appears.
thanks!

@hpk42 hpk42 closed this as completed Nov 4, 2024
@WofWca
Copy link
Collaborator

WofWca commented Dec 14, 2024

Hmmm I think I just encountered this issue (draft not getting removed) myself, on 1.49.0 (git: v1.33.0-1229-gc574dd42)

Could have to do with #4144 where we switched to throttle to save draft.

I suspect this mostly happens on heavier accounts.

@WofWca WofWca reopened this Dec 14, 2024
@hpk42
Copy link
Contributor Author

hpk42 commented Dec 14, 2024 via email

@Simon-Laux
Copy link
Member

i am wondering if there should be a more direct "send draft message" API

yes, that is actually the main idea of the composer rewrite. keep more of the state in core and don't recreate the draft every time it is changed.

@r10s
Copy link
Member

r10s commented Dec 14, 2024

i am wondering if there should be a more direct "send draft message" API
so that the UI executes an atomic action on core, that adds/sends the message
and clears the draft in one go.

this is already in place since since deltachat/deltachat-core-rust#2887: you can send_msg(draft_id) that sends the message out and clears the draft in one go (send_msg still takes a message object in that case, changing that to take a msg_id may make sense, but that is more cosmectic and not really the issue)

there was also deltachat/deltachat-core-rust#4839 added a long time ago, to make webxdc-staging work. but not totally sure, what is missing there, the corresponding issue to "to send webxdc app staged in draft with JSON-RPC" (#4643) was reopend a year ago.

so, from view of core/cffi and maybe even jsonrpc, "sending and clearing draft" is mostly fine - it is just that things are not (always) used that way (also not on android outside webxdc-drafts iirc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants