Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 52099bc

Browse files
msandbvaughn
authored andcommitted
Fix infinite retry loop (#1248)
(Together with a pr to react-native facebook/react-native#22625) Fixes facebook/react-native#21030
1 parent 38fe978 commit 52099bc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-devtools-core/src/backend.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function connectToDevTools(options: ?ConnectOptions) {
6767
// See D6251744.
6868
var ws = websocket ? websocket : new window.WebSocket(uri);
6969
ws.onclose = handleClose;
70-
ws.onerror = handleClose;
70+
ws.onerror = handleFailed;
7171
ws.onmessage = handleMessage;
7272
ws.onopen = function() {
7373
var wall = {
@@ -92,6 +92,12 @@ function connectToDevTools(options: ?ConnectOptions) {
9292
closeListeners.forEach(fn => fn());
9393
}
9494
}
95+
function handleFailed() {
96+
if (!hasClosed) {
97+
hasClosed = true;
98+
closeListeners.forEach(fn => fn());
99+
}
100+
}
95101

96102
function handleMessage(evt) {
97103
var data;

0 commit comments

Comments
 (0)