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

Possible to have multiple filePaths trigger change, but only one is reported #35

Open
bantic opened this issue Aug 17, 2016 · 1 comment

Comments

@bantic
Copy link

bantic commented Aug 17, 2016

When a change is detected, the watcher builds and then

Because the build is debounced, it's possible for multiple files to change before the build starts, but only the first one will get reported in the results hash filePath property.

This can be demonstrated by changing two files very quickly, e.g.:

  • touch path/to/a.js && touch path/to/b.js -> broccoli-sane-watcher emits change with {filePath: path/to/a.js}
  • touch path/to/b.js && touch path/to/a.js -> broccoli-sane-watcher emits change with {filePath: path/to/b.js}

I'm not sure how "public" the filePath property on the hash is considered to be, but the livereload server in ember-cli does use that property to determine whether it should trigger a livereload notification in the shouldTriggerReload method.

If it seems like a good idea to gather all the filepaths that changed before the build started and report them in a filePaths property on the results hash I would be happy to make a PR for that.

@bantic
Copy link
Author

bantic commented Aug 17, 2016

I first noticed this when I realized ember-cli's project.liveReloadFilterPatterns option wasn't working properly for me, and after digging in I discovered that my editor (vim) uses a "save" strategy that involves creating a very-short-lived temp file before modifying the original file. broccoli-sane-watcher was noticing the temp file change before the actual file change, and as a result only reporting the deletion of the temp file to ember-cli's shouldTriggerReload method.

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

1 participant