-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix edge case where files may briefly "disappear" during processing
Summary: Currently, when a file is modified on disk 1. The watcher backend emits a change event 2. `FileMap` receives the event, and deletes the in-memory record of the file (including from the Haste map, etc) 3. A worker processes the file 4. `FileMap` re-adds the file with new metadata If Metro is currently working (eg, building a bundle) it may attempt to read from the Haste or file maps between 2 and 4, and find that the file appears not to exist, which could fail the build either during resolution or transformation. This bug was introduced in [61c6066](61c6066) - prior to that, consumers would only receive snapshots of the data taken at "safe" points. Instead, it'd better for the file map to return the last known state of the file until it has updated state, as long as all exposed data is self-consistent. With this change, we move all removal logic under the `'delete'` event handler. ``` - **[Fix]**: Fix edge case where files may appear missing during bundling/resolution while being modified. ``` Reviewed By: huntie Differential Revision: D67762435 fbshipit-source-id: 85a1799662aa0adc8bfb9a326db93608b85dc97f
- Loading branch information
1 parent
dd3e56c
commit 2a0b548
Showing
2 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters