Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

[File Watchers] Renaming a file that's alone in a folder duplicates it in project tree #6474

Closed
couzteau opened this issue Jan 11, 2014 · 34 comments
Assignees
Milestone

Comments

@couzteau
Copy link
Member

new description:

  1. Open Getting Started project
  2. Open and close the screenshots folder
  3. switch to finder and rename screenshots/quick-edit.png to screenshots/test.png

Bug: a) The image test.png is now listed twice in the project tree
b) The folder screenshots has been opened.

old description:
Steps:

  1. Open Getting Started project
  2. switch to finder
  3. rename screenshots/quick-edit.png to screenshots/test.png

Bug: The image test.png is now listed twice in the project tree

I wouldn't be surprised if #6001 was related. - verified. It's not!

@couzteau
Copy link
Member Author

Looking at #6468 to see if that fixes the issue.

@jasonsanjose
Copy link
Member

Tagging fix in progress

@couzteau
Copy link
Member Author

#6468 does fix the duplicate entry. But there is a (minor?) side effect: the folder containing the image is collapsed when brackets gains focus.

@couzteau
Copy link
Member Author

No "fix in progress" tag yet. Tagging again.

@iwehrman
Copy link
Contributor

Should now be fixed by #6468. FBNC to @couzteau.

@ghost ghost assigned couzteau Jan 11, 2014
@jasonsanjose
Copy link
Member

Confirmed on the last bit about the collapsed folder. But I never got that to reproduce the first time. Please retest on master, thanks!

@couzteau
Copy link
Member Author

I still see the collapsed folder every time. If you follow the steps in the bug description, but make sure to expand the screenshots folder before you rename, you should see it too.

Leaving the bug open for now, but I'd be ok to close this one and open a new one about the closed folder. But I'd like to hear wether you can repro that.

@couzteau
Copy link
Member Author

Now I do see the duplicate entries on master again.

@couzteau
Copy link
Member Author

I have fixed #6001 on a branch off of master after the merge of jason's fix but that also doesn't fix the duplicate item.

branch: https://github.com/adobe/brackets/tree/couzteau/fix-6001-imgPreview-dupeOpen

@jasonsanjose
Copy link
Member

FYI There are 3 new pull requests around the file tree

#6494 fix rename events
#6495 fix expand/collapse state
#6496 undo file delete

I've got a branch that merges all 3 fixes jasonsanjose/issue-6474-again and I see different behavior with the Getting Started project.

When renaming ANY file in the getting started project, the tree doesn't update for me at all. If I create a copy of the project folder on my desktop, the tree updates...but I see @couzteau's bug where the folder node appears to close even though the style visible is still jstree-open. Toggling the node twice to collapse and expand will show the renamed file with the correct name.

Is it possible that being in the git repo has something to do with this bug?

@ghost ghost assigned jasonsanjose Jan 13, 2014
@jasonsanjose
Copy link
Member

I take that back, I can't reproduce the bug with jasonsanjose/issue-6474-again.

It looks like the change event doesn't work for the Getting Started project case because in our dev env we use a symlink to get to the getting started projects. @couzteau Can you try this bug on any other project that's not using a symlink in the ancestor path?

@julieyuan
Copy link

This duplication issue also reproduces for folders and files. Is it possible to fix it with this one or it has been fixed with latest pull request?

Steps for case folder name:

  1. Launch Brackets and open a project.
  2. New a folder (folder1) in this project.
  3. New a subfolder (folder2) or a file under folder1.
  4. Rename the subfolder(folder2) or this file on OS and observe the project tree in Brackets.

Result: In the project tree, it will show duplicated subfolder name.

@jasonsanjose
Copy link
Member

@julieyuan it looks like this is fixed by one of the pull requests above. I tested using branch that merges all 3 PRs jasonsanjose/issue-6474-again.

@couzteau
Copy link
Member Author

I quickly tested master and I also see the fix. Will test a bit more before closing.

@couzteau
Copy link
Member Author

FBNC

@ghost ghost assigned couzteau Jan 13, 2014
@couzteau
Copy link
Member Author

Confirmed fix. Closing.

@couzteau couzteau reopened this Jan 13, 2014
@couzteau
Copy link
Member Author

tested some more and I started to see the issue again. Currently I see this issue every time. Not sure what changed. Certainly not the code. I first saw it again, when reverting the name change I had previously made to verify the fix. The next thing is that I switch back to the Finder hit CMD-Z to revert the name change and Brackets updates the file tree, before it gains focus.

@couzteau
Copy link
Member Author

Currently I see this issue every time with the Getting started project. Other projects do not show the bug.

@couzteau
Copy link
Member Author

Sometimes i see the old and the new file names in the project tree instead of the duplicate item.

@jasonsanjose
Copy link
Member

@couzteau based on that, do you think we can re-title this bug as a symlink issue and not a more general problem?

@couzteau
Copy link
Member Author

@jasonsanjose Yes, but I'm not sure that that is really the issue. I have just reproduced the issue after it went away again via Finder's Undo, that is first rename is working fine, then going back to Finder Undo and then it comes back,

@couzteau
Copy link
Member Author

The reason I'm not convinced this has something to do with symlinks is that I can repro th bug when I open the getting stater project by point the brackets open project dialog directly to the getting started folder on disk.

@jasonsanjose
Copy link
Member

There might be a related fix here #6520, but it only affected file renames inside of brackets, not from external renames. But it could be possible that you had a rename in brackets that created an invalid cache of DOM nodes, leading to errors later on.

@couzteau
Copy link
Member Author

Checked out branch #6520 but I still see the issue. I have also deleted cef_data before testing to eliminate the odd chance that I was running of of stake or bad data.

@couzteau
Copy link
Member Author

@jasonsanjose How can I help you to look at this? Do you want to remote into my machine. I can repro it pretty much all the time.

@jasonsanjose
Copy link
Member

Not sure what was happening, but I can reproduce it now. Investigating.

@couzteau
Copy link
Member Author

Ok, I have done a bit more testing and I was able to create a 2nd test project to repro the issue. It appeared important that the image folder to contain only a single image.

@couzteau
Copy link
Member Author

Looks like there is one more edge case to fix before I can close this bug, you mentioned this in the pull request discussion: externally rename a file inside a closed folder creates a duplicate entry and opens the folder.

@couzteau
Copy link
Member Author

@jasonsanjose I pushed a branch with a partial fix for the remaining case: https://github.com/adobe/brackets/compare/couzteau;fix-6474

It addresses the issue of the duplicate entry, but the closed state of the folder is not yet maintained. But I think since you are more familiar with the jstree code, you'll be able to add that.
I don't like the fix, because it just calls refresh after thing went already wrong instead of preventing thing to go wrong, but I think it's still better than the duplicate entry. Let me know what you think.

@jasonsanjose
Copy link
Member

@couzteau can you try the branch in #6546 to see if this fixes the bug instead?

@jasonsanjose
Copy link
Member

Correction, see #6553 instead.

@couzteau
Copy link
Member Author

#6553 does not fix this bug. using the branch externally renaming a file inside a closed folder will both create a duplicate entry and open the folder.

@peterflynn
Copy link
Member

FBNC @couzteau

@couzteau
Copy link
Member Author

Happy to finally close this one for good. Thanks @jasonsanjose @peterflynn - this WAS a nasty bug.

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

No branches or pull requests

5 participants