Skip to content

Commit b3f688e

Browse files
huntiegabrieldonadel
authored andcommitted
Exclude legacy Hermes targets from single host assertion (#54784)
Summary: Pull Request resolved: #54784 This is a follow-up to D86201689 following user feedback on `0.83.0-rc.2`: react-native-community/discussions-and-proposals#954 (reply in thread). The problem was that we were incorrectly attributing any and all `IInspector::addPage()` calls to represent a new React Native Host being registered. However, this API also remains common to the legacy Hermes `ConnectionDemux` runtime target setup (which does not represent a host target). We now fork this code path internally based on `InspectorTargetCapabilities.prefersFuseboxFrontend`, in order to track `registeredHostsCount` accurately (i.e. **only** for HostTarget page registrations). Changelog: [General][Fixed] - React Native DevTools: Fix a bug where we would incorrectly flag apps using additonal Hermes runtimes (e.g. Reanimated) as being multi-host Reviewed By: hoxyq Differential Revision: D88386623 fbshipit-source-id: 49a82faa6c857de41e8e9a757f5fdd850f09c3dd
1 parent c4772a4 commit b3f688e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/react-native/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,13 @@ int InspectorImpl::addPage(
143143
pageId,
144144
Page{pageId, description, vm, std::move(connectFunc), capabilities});
145145

146-
for (const auto& listenerWeak : listeners_) {
147-
if (auto listener = listenerWeak.lock()) {
148-
listener->unstable_onHostTargetAdded();
146+
// Strong assumption: If prefersFuseboxFrontend is set, the page added is a
147+
// HostTarget and not a legacy Hermes runtime target.
148+
if (capabilities.prefersFuseboxFrontend) {
149+
for (const auto& listenerWeak : listeners_) {
150+
if (auto listener = listenerWeak.lock()) {
151+
listener->unstable_onHostTargetAdded();
152+
}
149153
}
150154
}
151155

0 commit comments

Comments
 (0)