Connect debugger before loading bundle (#53203)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53203

Changelog: [internal]

This makes ReactHost connect the inspector immediately after creating the instance, aligned with how we do it on Android, instead of doing it as part of loading a bundle.

Reviewed By: rshest

Differential Revision: D79804004

fbshipit-source-id: b165520b0feb089fdfaa323413d697939c7ac794
This commit is contained in:
Rubén Norte authored and Facebook GitHub Bot committed 2025-08-12 05:41:11 -07:00
1 parent e0b22e1ebf
commit c2c2e6b7c2
1 file changed
+4 -3
@@ -240,6 +240,10 @@ void ReactHost::createReactInstance() {
auto jsInvoker = std::make_shared<RuntimeSchedulerCallInvoker>(
reactInstance_->getRuntimeScheduler());
if (inspector_ != nullptr) {
inspector_->connectDebugger(devServerHelper_->getInspectorUrl());
}
auto liveReloadCallback = [this]() { reloadReactInstance(); };
reactInstance_->initializeRuntime(
{
@@ -451,9 +455,6 @@ bool ReactHost::loadScriptFromDevServer() {
auto script = std::make_unique<JSBigStdString>(response);
reactInstance_->loadScript(
std::move(script), devServerHelper_->getBundleUrl());
if (inspector_ != nullptr) {
inspector_->connectDebugger(devServerHelper_->getInspectorUrl());
}
devServerHelper_->setupHMRClient();
return true;
} catch (...) {