Tweak HMR updates order

Reviewed By: sam-swarr

Differential Revision: D3007914

fb-gh-sync-id: efceeeafdaaf82e47ee2d2e8a313b64694988b5c
shipit-source-id: efceeeafdaaf82e47ee2d2e8a313b64694988b5c
This commit is contained in:
Martín Bigio 2016-03-03 16:06:30 -08:00 committed by Facebook Github Bot 2
parent 1b4c23e001
commit d5d9c5a7c6
1 changed files with 10 additions and 0 deletions

View File

@ -174,6 +174,16 @@ function attachHMRServer({httpServer, path, packagerServer}) {
}
});
// Need to send modules to the client in an order it can
// process them: if a new dependency graph was uncovered
// because a new dependency was added, the file that was
// changed, which is the root of the dependency tree that
// will be sent, needs to be the last module that gets
// processed. Reversing the new modules makes sense
// because we get them through the resolver which returns
// a BFS ordered list.
modulesToUpdate.reverse();
// invalidate caches
client.dependenciesCache = dependenciesCache;
client.dependenciesModulesCache = dependenciesModulesCache;