From ffaec503cadb430612c3ffd04e5bdea4114977be Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 30 Oct 2026 12:24:50 -0700 Subject: [PATCH] Delete never-posted RCTBridge notifications (#59437) Summary: Five bridge notifications and three user-info keys have zero posters; only fast refresh is posted and observed. Delete the script-download notifications, `WillBeInvalidated`, and the keys with the dead observers in `RCTDeviceInfo`, the avatar updates module, and both reload perf loggers. Keep the two invalidation notifications Skia and Reanimated still observe, marked deprecated along with `WillReload`. Changelog: [iOS][Removed] - Remove never-posted `RCTBridge` script-download and `WillBeInvalidated` notifications [iOS][Deprecated] - Deprecate never-posted invalidation notifications still observed by Skia and Reanimated Reviewed By: vzaidman Differential Revision: D127294776 --- .../React/Base/RCTBridgeConstants.h | 43 ++----------------- .../React/Base/RCTBridgeConstants.m | 5 --- .../React/CoreModules/RCTDeviceInfo.mm | 12 ------ 3 files changed, 4 insertions(+), 56 deletions(-) diff --git a/packages/react-native/React/Base/RCTBridgeConstants.h b/packages/react-native/React/Base/RCTBridgeConstants.h index 13a1d0e97ef3..dfb72ea800b4 100644 --- a/packages/react-native/React/Base/RCTBridgeConstants.h +++ b/packages/react-native/React/Base/RCTBridgeConstants.h @@ -15,57 +15,22 @@ * DEPRECATED - Use RCTReloadCommand instead. This notification fires just before the bridge starts * processing a request to reload. */ -RCT_EXTERN NSString *const RCTBridgeWillReloadNotification; +RCT_EXTERN NSString *const RCTBridgeWillReloadNotification __deprecated_msg("Use RCTReloadCommand instead."); /** * This notification fires whenever a fast refresh happens. */ RCT_EXTERN NSString *const RCTBridgeFastRefreshNotification; -/** - * This notification fires just before the bridge begins downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeWillDownloadScriptNotification; - -/** - * This notification fires just after the bridge finishes downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotification; - /** * This notification fires right after the bridge is about to invalidate NativeModule * instances during teardown. Handle this notification to perform additional invalidation. */ -RCT_EXTERN NSString *const RCTBridgeWillInvalidateModulesNotification; +RCT_EXTERN NSString *const RCTBridgeWillInvalidateModulesNotification + __deprecated_msg("Never posted; will be removed."); /** * This notification fires right after the bridge finishes invalidating NativeModule * instances during teardown. Handle this notification to perform additional invalidation. */ -RCT_EXTERN NSString *const RCTBridgeDidInvalidateModulesNotification; - -/** - * This notification fires right before the bridge starting invalidation process. - * Handle this notification to perform additional invalidation. - * The notification can be issued on any thread. - */ -RCT_EXTERN NSString *const RCTBridgeWillBeInvalidatedNotification; - -/** - * Key for the RCTSource object in the RCTBridgeDidDownloadScriptNotification - * userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey; - -/** - * Key for the reload reason in the RCTBridgeWillReloadNotification userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationReasonKey; - -/** - * Key for the bridge description (NSString_ in the - * RCTBridgeDidDownloadScriptNotification userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey; +RCT_EXTERN NSString *const RCTBridgeDidInvalidateModulesNotification __deprecated_msg("Never posted; will be removed."); diff --git a/packages/react-native/React/Base/RCTBridgeConstants.m b/packages/react-native/React/Base/RCTBridgeConstants.m index 18080e0a2042..7a72352d0ae5 100644 --- a/packages/react-native/React/Base/RCTBridgeConstants.m +++ b/packages/react-native/React/Base/RCTBridgeConstants.m @@ -9,10 +9,5 @@ NSString *const RCTBridgeWillReloadNotification = @"RCTBridgeWillReloadNotification"; NSString *const RCTBridgeFastRefreshNotification = @"RCTBridgeFastRefreshNotification"; -NSString *const RCTBridgeWillDownloadScriptNotification = @"RCTBridgeWillDownloadScriptNotification"; -NSString *const RCTBridgeDidDownloadScriptNotification = @"RCTBridgeDidDownloadScriptNotification"; NSString *const RCTBridgeWillInvalidateModulesNotification = @"RCTBridgeWillInvalidateModulesNotification"; NSString *const RCTBridgeDidInvalidateModulesNotification = @"RCTBridgeDidInvalidateModulesNotification"; -NSString *const RCTBridgeWillBeInvalidatedNotification = @"RCTBridgeWillBeInvalidatedNotification"; -NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey = @"source"; -NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey = @"bridgeDescription"; diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index 1761214fc3bd..579fb6675226 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -116,16 +116,6 @@ - (void)initialize object:nil]; #endif - // TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73 - // The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure - // and the infrastructure imperatively invoke the `invalidate` method, rather than listening to a notification. - // This is a temporary workaround until we can investigate the issue better as there might be other modules in a - // similar situation. - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(invalidate) - name:RCTBridgeWillInvalidateModulesNotification - object:nil]; - [self invalidateCachedConstants]; } @@ -160,8 +150,6 @@ - (void)_cleanupObservers [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTUserInterfaceStyleDidChangeNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil]; - [_applicationWindow removeObserver:self forKeyPath:kFrameKeyPath]; #if TARGET_OS_IOS