twenty icon indicating copy to clipboard operation
twenty copied to clipboard

5077: fix buggy title input reappearing after delete

Open AlexVascon opened this issue 10 months ago • 3 comments

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);

setTitleDebounced(newTitle);

persistTitleDebounced(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.

AlexVascon avatar Apr 21 '24 16:04 AlexVascon

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project. By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by :no_entry_sign: dangerJS against e5f9e3e87d1c2f71efd9aa3ec0786eefe57bb759

github-actions[bot] avatar Apr 21 '24 17:04 github-actions[bot]

Hi @AlexVascon could you link the related issue ?

lucasbordeau avatar May 01 '24 13:05 lucasbordeau

This area is not well finished yet, debouncing introduces some complexities that are not fully handled in a deterministic manner yet, as you found out.

lucasbordeau avatar May 01 '24 13:05 lucasbordeau

@AlexVascon I'm going to close this PR, setting the debounce to zero does remove the issue but it is also spamming the server. We need to find a better strategy here but this will require some resources. As we are going to refactor this part on the long run (we plan to introduce an enhanced right drawer panel that will take a bigger place in the app), we will revisit it at this moment Thanks for taking a look, it's much appreciated!

charlesBochet avatar May 22 '24 09:05 charlesBochet