Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore errors in unreachable modules (#1164)
Summary: Pull Request resolved: #1164 Currently, if Metro encounters an error resolving a dependency or transforming a module that is present in the graph at the time the error is introduced, it will return the error to the client *and continue to do so, even after the bad dependency is subsequently made unreachable by another change*. This is "fixed" by a full refresh or Metro restart, because a new traversal would not encounter the error, and is therefore a correctness bug. This diff fixes the bug by: - Collecting, instead of immediately throwing on, transform and resolution errors during `buildSubgraph` (prior to any state modification). - If there are errors, take a snapshot of all of the modified modules at the base state. - Commit *removals only*, skipping modified modules with errors, and collect cycles (the "subtractive pass") - this should never fail. - Try to commit new and modified dependencies starting from the modified modules still present in the graph (the "additive pass"). Any error caught here corresponds to a reachable error the user must action. - On catching an error, commit the base state we captured earlier, rolling the graph back, and re-throw the error. Changelog: ``` **[Fix]**: Ignore errors in unreachable modules during incremental builds. ``` Reviewed By: motiz88 Differential Revision: D52457312 fbshipit-source-id: 6dabb58e6aa899532ffcdd2eea97d4753aa87e21
- Loading branch information