You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
watched file is duplicated in callback in certain cases #55
I have encountered an interesting case where watcher is sometimes firing the callback and reporting the same file has been changed more than once. Is this intended behaviour? I think this occurs when a file changes more than once before R is able to fire the callback. An example:
This has caused me issues because I was watching a json file, and essentially having a callback which ran jsonlite::read_json(file), this leads to file erroring with invalid 'description' argument error. my solution is to simply take the first item for file, which is fine for my particular use case.
It's possible to get duplicates as e.g. a single write can generate multiple filesystem events at source (Created/Updated).
However, we only ever return the paths to R and no additional information about the event, hence it's arguably not useful to have duplicated paths, and creates extra work in your case above.
We can solve this by making the events consolidated ('bubbled') before the callback fires, so the paths reported by a single callback are always unique.
Activity
shikokuchuo commentedon Oct 12, 2026
It's possible to get duplicates as e.g. a single write can generate multiple filesystem events at source (
Created/Updated).However, we only ever return the paths to R and no additional information about the event, hence it's arguably not useful to have duplicated paths, and creates extra work in your case above.
We can solve this by making the events consolidated ('bubbled') before the callback fires, so the paths reported by a single callback are always unique.