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

Fix infinite retry loop #1248

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/react-devtools-core/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function connectToDevTools(options: ?ConnectOptions) {
// See D6251744.
var ws = websocket ? websocket : new window.WebSocket(uri);
ws.onclose = handleClose;
ws.onerror = handleClose;
ws.onerror = handleFailed;
ws.onmessage = handleMessage;
ws.onopen = function() {
var wall = {
Expand All @@ -91,6 +91,12 @@ function connectToDevTools(options: ?ConnectOptions) {
closeListeners.forEach(fn => fn());
}
}
function handleFailed() {
if (!hasClosed) {
hasClosed = true;
closeListeners.forEach(fn => fn());
}
}

function handleMessage(evt) {
var data;
Expand Down