Open TobyEalden opened 1 week ago
Seems to make sense, assuming that is the intended use of "initial files".
If we define "initial" as any time you start watching a directory, we should fix this
Good to get the opinion of @paulmillr here since it's from before me
Idk how would we track these files
Presumably we currently read the directory and emit all the children. Then when we unwatch and watch it, we won't read through it a second time
Maybe it's as simple as always reading the directory when you watch one?
So we don't need to track anything extra for it. I might be missing something though in my understanding
It looks like _handleRead
already deals with the initial load, but it uses the previous directory entries to determine if it needs to emit or not
The pull request #1388 handles this by closing the descendants as well as the unwatched path in closePath, but I'm not sure of the function of (or interaction with) ignoredPaths
...
feels like it makes sense to me. when you remove a watched path, clearing all of its children
we just need to decide if this is a breaking change or not and if its the behaviour we're all agreed on
as it means we will start emitting events which we didn't used to emit
Describe the bug This is a duplicate of https://github.com/paulmillr/chokidar/issues/1185, which has been closed, however the test case still fails.
With
ignoreInitial
set to false, when first adding a directory all the initial files are emitted. If the directory is un-watched and then watched again at some point in the future, the initial files are not emitted.Versions (please complete the following information):
To Reproduce:
Expected behavior Un-watching and then re-watching a directory should cause the initial files to be emitted if
ignoreInitial
is false.