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

Save draft on chat change #4144

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxphilippov
Copy link
Collaborator

@maxphilippov
Copy link
Collaborator Author

maxphilippov commented Sep 23, 2024

OUTDATED: This is a thing we discussed a long time ago, we had a 1 second debounce for saving draft, so if you're in any way fast at switching between different chats you just lose what you were typing right before switching. We were talking about testing something around 200-300ms, I went for 100.

@maxphilippov maxphilippov force-pushed the maxph/composer-quote-debounce-reduce branch 2 times, most recently from c9e78c0 to 2896590 Compare October 15, 2024 20:40
@maxphilippov maxphilippov marked this pull request as ready for review October 15, 2024 20:40
@maxphilippov maxphilippov changed the title Try to reduce debounce timing for draft change Save draft on chat change Oct 15, 2024
@maxphilippov
Copy link
Collaborator Author

I did keep the original 1 second delay between autosave

Copy link
Collaborator

@WofWca WofWca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do you suggest to save the draft on every key press? Because this is what's happening in this MR, and it doesn't seem intentional.

CHANGELOG.md Outdated Show resolved Hide resolved
@maxphilippov maxphilippov force-pushed the maxph/composer-quote-debounce-reduce branch from 2896590 to dd5b26b Compare October 16, 2024 10:22
- resolves 3733
@maxphilippov maxphilippov force-pushed the maxph/composer-quote-debounce-reduce branch from dd5b26b to 3a10e62 Compare October 16, 2024 10:36
@maxphilippov
Copy link
Collaborator Author

So do you suggest to save the draft on every key press? Because this is what's happening in this MR, and it doesn't seem intentional.

Oops, my bad, rushed that a bit. Didn't notice we have a setState above. I'll draft it for now. Reverted back to 200ms, removed saveDraft from onChange then. Gonna look for a way to maybe flush via ref to messageInputComposer. I don't agree with throttle, since I don't see the point in saving first character immediately and thus pushing next save further in time. Next save is what's more likely to happen on chat change.

@maxphilippov maxphilippov marked this pull request as draft October 16, 2024 10:44
@WofWca
Copy link
Collaborator

WofWca commented Oct 16, 2024

thus pushing next save further in time

I don't think that's how throttle works. Throttle is never less frequent than debounce.

@maxphilippov
Copy link
Collaborator Author

thus pushing next save further in time

I don't think that's how throttle works. Throttle is never less frequent than debounce.

Oh, my bad again, for some reason I got memorized that debounce is just throttle but without the inital call (so it calls at the end of time interval while throttle in the beginning). Yeah, makes sense then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message draft discarded when switching to different chat quickly
2 participants