diff --git a/packages/react-native/ReactCommon/react/networking/NetworkReporter.cpp b/packages/react-native/ReactCommon/react/networking/NetworkReporter.cpp index d74c2e1e291a..bab22243aee8 100644 --- a/packages/react-native/ReactCommon/react/networking/NetworkReporter.cpp +++ b/packages/react-native/ReactCommon/react/networking/NetworkReporter.cpp @@ -233,7 +233,12 @@ void NetworkReporter::reportResponseEnd( void NetworkReporter::reportRequestFailed( const std::string& requestId, - bool cancelled) const { + bool cancelled) { + { + std::lock_guard lock(perfTimingsMutex_); + perfTimingsBuffer_.erase(requestId); + } + #ifdef REACT_NATIVE_DEBUGGER_ENABLED // Debugger enabled: CDP event handling jsinspector_modern::NetworkHandler::getInstance().onLoadingFailed( diff --git a/packages/react-native/ReactCommon/react/networking/NetworkReporter.h b/packages/react-native/ReactCommon/react/networking/NetworkReporter.h index 8543afd715ca..51d5d51b3e45 100644 --- a/packages/react-native/ReactCommon/react/networking/NetworkReporter.h +++ b/packages/react-native/ReactCommon/react/networking/NetworkReporter.h @@ -122,7 +122,7 @@ class NetworkReporter { * * Corresponds to `Network.loadingFailed` in CDP. */ - void reportRequestFailed(const std::string &requestId, bool cancelled) const; + void reportRequestFailed(const std::string &requestId, bool cancelled); /** * Report that a WebSocket connection is about to be created.