Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch is triggered twice for files and folders with same name #231

Open
mike-suggitt opened this issue May 31, 2016 · 6 comments
Open

Watch is triggered twice for files and folders with same name #231

mike-suggitt opened this issue May 31, 2016 · 6 comments

Comments

@mike-suggitt
Copy link

mike-suggitt commented May 31, 2016

If i run a watch for /html/**/* and have a file structure such as this:

html
     folder.html
     folder2.html
     folder
             code.html
             code2.html

When I make changes to code.html then watch is triggered twice, firstly with folder.html then with code.html. If I change the name of "folder" to "folder2" and update folder.html it will only trigger once.

Likewise if I then make changes to code2.html then it will trigger twice, once with folder2.html and then with code2.html

@UltCombo
Copy link
Collaborator

Can you try the latest version and check if you can still reproduce the issue? I cannot reproduce it.

@UltCombo
Copy link
Collaborator

I didn't manage to reproduce the issue when editing files, but I did manage to trigger a similar issue: when creating a new directory inside folder, it triggered a change event for folder.html and folder2.html. It looks like a Chokidar bug, will investigate and report it tomorrow if I manage to.

@mike-suggitt
Copy link
Author

I'll re-check with current and latest version and let you know. The other thing I've thought of which may be an issue is that I'm using WebStorm so that may be doing something funky with the way it saves files (e.g. twice)

@UltCombo
Copy link
Collaborator

Seems related to nodejs/node#4351, libuv/libuv#682

@UltCombo
Copy link
Collaborator

This may be fixed in Node v7.1.0 as it uses libuv 1.10.0 which likely includes a fix for this issue. Can someone test on a Windows machine to confirm?

@UltCombo
Copy link
Collaborator

It seems this specific problem (firing unexpected change events for upper-level files) has been fixed in Node 7.1.0. However, it seems a new problem arises in Node 7.1.0 as well: after the first addDir event fires (e.g. addDir html/folder/a), it seems it will no longer fire further unlinkDir/addDir events for that given path. Will need further investigation, but this is likely a Chokidar or libuv issue.

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

No branches or pull requests

2 participants