Fix issue #39: Ensure new files are consistently added under folders …#47
Fix issue #39: Ensure new files are consistently added under folders …#47SahilLamba0008 wants to merge 3 commits intometz-sh:mainfrom
Conversation
…olders in file-tree view
|
@SahilLamba0008 this looks good, but can you add details about the bug, why it happens and how your solution handles all cases? |
As per my understanding of the code :
|
| getFolderContextMenu(props.path, { | ||
| onAddNewClick() { | ||
| setIsBeingAddedTo(true); | ||
| setOpened((open) => !open); // change folder open state when adding new file |
There was a problem hiding this comment.
Let's be explicit about the state of 'opened' here
There was a problem hiding this comment.
by being explicit, do you mean to set the state directly here instead on depending on prevState ? In that case the solution would be just set the opened state as false setOpened(false);. should I raise a new pr for this ?
There was a problem hiding this comment.
That sounds workable but the end result would look like:
- open folder with lot of files under it
- right click
- select 'Add new'
- and the the folder will fully collapse
This can be a bit jarring UX. Can we figure out what the root cause it and fix it in such a way that opening or closing a folder has no impact on adding new files?
There was a problem hiding this comment.
If you are worried about the parent folder collapsing when adding a new folder inside it, don't worry-it won't happen. I have tested this solution locally. However, in my opinion, the optimal solution would be that opening and closing the folder should not affect adding new files. Working on the same.
|
Sorry for the delay @SahilLamba0008! I have added a small comment, please take a look. |
|
Hi @iostreamer-X , sorry for the delay, got busy with some office work. Talking about the issue, upon further debugging it caught my eye that actually, the functionality of adding folders is working completey fine already. It is not dependent on any state as it is calling Screen.Recording.2024-10-23.at.12.06.58.PM.1.mp4Will update soon with a PR, meanwhile if have any insights that can help feel free to share. |
…rved redundant function calls
Ohh, good eye. To be honest, I am not really sure of its root cause. Let me check this as well. Thank you sharing this! |
Fix: Issue #39 - File-tree View Add New File Bug
Video :
Screen.Recording.2024-10-08.at.7.53.08.PM.mp4
Please review and let me know if any additional changes are needed.