Summary
useFileWatch in packages/data/src/hooks/useFileWatch.ts creates a new watcher when path or options change, but it does not reset data, error, or loading for the new target.
Reproduction
- Watch path A and trigger a change so data is populated.
- Re-render the hook with path B.
- Inspect the hook state before path B emits any event.
Expected behavior
A new watched path should start with data: null, error: null, and loading: true until the new watcher receives an event or fails.
Actual behavior
The last event from path A remains visible while the hook is already watching path B, which can make file monitors report changes for the wrong target.
Summary
useFileWatch in packages/data/src/hooks/useFileWatch.ts creates a new watcher when path or options change, but it does not reset data, error, or loading for the new target.
Reproduction
Expected behavior
A new watched path should start with data: null, error: null, and loading: true until the new watcher receives an event or fails.
Actual behavior
The last event from path A remains visible while the hook is already watching path B, which can make file monitors report changes for the wrong target.