Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unregister JSDevSupport from DebugCorePackage
Summary: ## Problem `DebugCorePackage` is a `TurboReactPackage`. To register a `TurboReactPackage`s NativeModules, the `NativeModuleRegistryBuilder` loops over all `ReactModuleInfo`s in the package's auto-generated `ReactModuleInfo` list. This list is generated from the `ReactModuleList` annotation of the package using our annotation processors. Because `JSDevSupport` was in its package's `ReactModuleList` annotation, we generated a `ReactModuleInfo` object for it. Therefore, `NativeModuleRegistryBuilder` registered `JSDevSupport` twice (once in `DebugCorePackage` and twice in `Fb4aReactPackage`). ## How did this work before? `JSDevSupport` was always a part of the `ReactModuleList` annotation of `DebugCorePackage`. However, before D18974084 landed, there were two key things that made this work: 1. `DebugCorePackage` was a `LazyReactPackage`, 2. The `DebugCorePackage.getNativeModules()` did not return a `ModuleHolder` for `JSDevSupport`. For `LazyReactPackage`s, `NativeModuleRegistryBuilder` calls `LazyReactPackage.getNativeModuleIterator()` to register NativeModules. The iterator returned from `LazyReactPackage.getNativeModuleIterator()`, in this case, loops over the NativeModules returned from `DebugCorePackage.getNativeModules()`. Therefore, we don't register any NativeModules that aren't in `DebugCorePackage.getNativeModules()`. Since `DebugCorePackage.getNativeModules()` didn't contain `JSDevSupport`, it wasn't registered for the second time. Changelog: [Android][Fixed] - Unregister JSDevSupport from DebugCorePackage Reviewed By: ejanzer Differential Revision: D19187664 fbshipit-source-id: 34141c60542179567d75705937ba09ec8a3dfc2b
- Loading branch information
Showing 2 changed files with 1 addition and 4 deletions.