Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bridge Mode: Make TurboModule invalidation more robust (#38357)
Summary: Pull Request resolved: #38357 ## Context On iOS, NSNotificationCenter facilitates event dispatch: - People can dispatch events **to** objects. - People can subscribe to events coming **from** objects. (By specifying objects, NSNotificationCenter also implements event filtering). The TuboModule system uses NSNotificationCenter to implement module invalidation: - The bridge dispatches invalidation notifications to its parentBridge object. - The TurboModuleManager listens to those invalidation notifications from the parentBridge object. ## Problem In some apps, the TurboModuleManager never invalidates modules. The bridge dispatches its invalidation notifications to nil: the parentBridge gets deallocated before bridge invalidation finishes. But, the TurboModuleManager never receives those invalidation notifications: it is listening to invalidation notifications coming from a non-nil parentBridge. ## Fix Make the TurboModuleManager listen to invalidation notifications from all objects. It will just manually noop invalidation if the notification's bridge object doesn't match its own bridge object. (This is existing logic). Changelog: [Internal] Reviewed By: javache Differential Revision: D47485910 fbshipit-source-id: 163403ef01f7d164a0e482f0f770a801d572503b
- Loading branch information