-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incremental build bug with parallel edges to the same module
Summary: When two imports from the same origin module resolve to the same target module, Metro can get a little confused. Consider the following example: ``` import './Module/index'; ┌─────────────────────────────────────────┐ │ ▼ ┌───────────┐ import './Module'; ┌──────────────────┐ │ /Entry.js │ ──────────────────────────▶ │ /Module/index.js │ └───────────┘ └──────────────────┘ ``` If, while the app is running, we delete *one* of the imports but not the other, Metro will stop correctly propagating updates of `/Module/index.js` to its "parent", `/Entry.js`. Fast Refresh will **appear** to work (the UI indicator will flash briefly) but the app will reflect the *old* contents of `/Module/index.js`. This happens because DeltaBundler's data structure for keeping track of a module's inverse dependencies is a set keyed on absolute paths, which doesn't account for parallel edges ( = multiple inverse dependencies from the same origin module). Here we change this data structure to a `CountingSet` - a modified `Set` that only deletes items when the number of `delete(item)` calls matches the number of `add(item)` calls. Reviewed By: huntie Differential Revision: D37194640 fbshipit-source-id: 89c190b0de3ec75b533f2d41a7024f17d31c59b0
- Loading branch information
1 parent
3877d2d
commit fc29a11
Showing
11 changed files
with
462 additions
and
24 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
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
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
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
Oops, something went wrong.