Skip to content

Commit 9813abc

Browse files
fix: reset StartupLogger on JS reload so runJsBundleStart marker is recorded (#56339)
PR #54255 (which made StartupLogger reset on APP_STARTUP_START) introduced a regression in 0.83 where the `runJsBundleStart` performance marker is dropped on JS reload. On reload, RUN_JS_BUNDLE_START and INIT_REACT_RUNTIME_START fire and are rejected by the still-populated StartupLogger as duplicates; only afterward does APP_STARTUP_START fire and reset the logger, leaving NaN start times paired with valid end times. As a result `performance.measure('runJsBundle', 'runJsBundleStart', 'runJsBundleEnd')` throws "The mark 'runJsBundleStart' does not exist." after the first load. Pre-emptively call StartupLogger::reset() at the top of ReactInstance::loadScript so every load (including reloads) starts with a clean logger and the startup markers are recorded correctly each time.
1 parent ccff70b commit 9813abc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ void ReactInstance::loadScript(
248248
beforeLoad(runtime);
249249
}
250250
TraceSection s("ReactInstance::loadScript");
251+
// Reset the StartupLogger so that JS reloads re-record all START/STOP
252+
// timings. Without this, the APP_STARTUP_START handler resets the logger
253+
// mid-sequence (after RUN_JS_BUNDLE_START / INIT_REACT_RUNTIME_START have
254+
// already been rejected as duplicates), leaving NaN start times paired
255+
// with valid end times. See issue #56339.
256+
ReactMarker::StartupLogger::getInstance().reset();
251257
bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl != nullptr);
252258
if (hasLogger) {
253259
ReactMarker::logTaggedMarkerBridgeless(

0 commit comments

Comments
 (0)