5077: fix buggy title input reappearing after delete #5080
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Full disclosure this is not a permanent solution. I did spend a lot of time on it and have pinpointed the issue area. It took me some time to get it to run locally properly. Unfortunately I could not get graphql to work, limiting some functionality. For example in the issue video the note automatically renders in the notes list as you are creating the note. Since I could not get the graphql extension to work for some reason I did not have this functionality which can effect result.
However the debounce is more to do with stopping something from triggering too often., so the title state still remains and will show up in both places. It's just the input gets cached and when you delete it, it reappears moments later because of the cashing solution. The fact is trying to create a title and being unable to delete it without some challenge is rather annoying.
The issue is in the ActivityTitle.tsx file. In the handleTitleChange function.
const handleTitleChange = (newTitle: string) => {
setActivityTitle(newTitle);
};
in the setTitleDebounced function I set the timeout to 0. This allowed me to delete characters by ether pressing delete or holding the delete button, without the whole text reappearing. I did not have to edit the persistTitleDebounced.