auto-save for a task description sometimes moves the cursor back to the start of the textbox
I am using v0.18.1 of both the frontend and the backend.
When editing a task's description in either Safari v13.1.2 (macos High Sierra) or Chrome 94 (latest), I sometimes experience annoying behaviour with the auto-save feature. When the autosave completes, it will move the text cursor to the start of the textbox. This means when I continue typing, the text appears to be at the front. Sometimes the autosave even gets into a loop, where it switches between text I have typed at the start of the description and where I was typing beforehand.
the problem seems more likely to occur if I start typing while the auto-save is in progress.
It would be great if there was an option in the user settings to disable this feature. I don't have any issues when editing comments, as they don't have the auto-save functionality.
I wouldn't even call that a feature, thats a bug.
Just to be sure, that only happens when editing the task description?
We plan to replace the editor in general with something else (#781) which will hopefully make that problem go away.
Yes, definitely a bug. And yes, I've only seen this behaviour when editing task description, due to auto-save.
It seems that the autosaving is sometimes racing with itself. There are a couple of points I've noticed:
- After saving, it restores the string that it saved, removing anything that was typed since
- However, it might have in the meantime started another save of what was typed since, leading to an infinite loop of auto saving between two states
- It seems to me that auto save is not debounced hard enough to only happen after typing has stopped, or should not be restoring the value it saved if it has changed since.
@freaktechnik Thanks for your observations.
I think the easiest way to fix that would be to either
- Disable autosave completely
- Increase the autosave debounce to something longer, maybe 10 seconds
- Cancel any save requests which are currently running when the user types again
A combination of the last two is probably the way to go.
It sounds a bit like the speed of internet connection plays a role here. Did you check that, maybe with the connection emulator in chrome?
To avoid what I'm seeing if anything the save would have to be faster, since what happens is
- I start typing/interacting with the editor (could also be using some wysiwyg button)
- Autosave triggers for "Foo"
- I continue adding input " bar"
- Autosave completes and restores the editor contents to "Foo"
Making the network slower would only make this worse.
Deleting a branch is permanent. It CANNOT be undone. Continue?