-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 not running with last file content when file changes multiple times #48909
Comments
watch mode is throttled for a change once in every 500 ms,
that number was chosen arbitrarily just as a heuristic on how often ides/users save files, and obviously, watch mode is designed to work with ides and not scripts like the above. that being said - if you believe we should decrease this value a PR is welcomed |
I believe people expect file watchers to act in a eventually consistent way where if files stop changing it eventually runs and produces an output based on the final state of the filesystem. I tried to not prescribe a solution in my original ticket as I would personally be fine with any debounce/throttle logic that achieves this. Some alternatives that would fulfill this would be:
I encountered this issue when i watched a file produced by a build tool. The build tool touched the file twice. First doing basically nothing to it and then updating it. It was very surprising to me that the the code that ran last didn't match the code i could see on disk. |
reopening - maybe we should change from throttle to debounce |
Version
v20.5.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
watchthis.js
runthis.js
with the following content:node --watch ./watchthis.js
in a terminalnode runthis.js
in another terminalHow often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
The last printed value in the first terminal should be "bar".
What do you see instead?
The last printed value is "foo".
Additional information
No response
The text was updated successfully, but these errors were encountered: