mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix per-tap OkHttpClient allocation in RedBoxContentView (#55578)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55578 RedBoxContentView.OpenStackFrameTask was creating a new OkHttpClient() (with a fresh connection pool and thread pool) every time a user tapped a stack frame in the red box. Replace with the shared DevSupportHttpClient.httpClient singleton. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D93480250 fbshipit-source-id: 882c218e709681e5f5fb22b4b35710d23f349c8e
This commit is contained in:
1 parent
99ed9101ee
commit
a92c7b1a2d
1 file changed
+2
-2
+2
-2
@@ -33,12 +33,12 @@ import android.widget.TextView
|
||||
import com.facebook.common.logging.FLog
|
||||
import com.facebook.react.R
|
||||
import com.facebook.react.common.ReactConstants
|
||||
import com.facebook.react.devsupport.inspector.DevSupportHttpClient
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
import com.facebook.react.devsupport.interfaces.ErrorType
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler
|
||||
import com.facebook.react.devsupport.interfaces.StackFrame
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import org.json.JSONObject
|
||||
@@ -165,7 +165,7 @@ internal class RedBoxContentView(
|
||||
.query(null)
|
||||
.build()
|
||||
.toString()
|
||||
val client = OkHttpClient()
|
||||
val client = DevSupportHttpClient.httpClient
|
||||
for (frame in stackFrames) {
|
||||
val payload = stackFrameToJson(checkNotNull(frame)).toString()
|
||||
val body: RequestBody = RequestBody.create(JSON, payload)
|
||||
|
||||
Reference in new issue
Block a user