From 17ab11e279e2819e2049a8ea62db3482bfc7bd50 Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Sun, 25 Sep 2016 12:38:31 +0100 Subject: [PATCH] Add an unobtrusive log when server disconnects --- packages/react-dev-utils/webpackHotDevClient.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index 120b8680a..b92a00591 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -130,9 +130,15 @@ var connection = new SockJS(url.format({ // Hardcoded in WebpackDevServer pathname: '/sockjs-node' })); -// Note: unlike WebpackDevServer's built-in client, -// we don't handle disconnect. If connection fails, -// just leave it instead of spamming the console. + +// Unlike WebpackDevServer client, we won't try to reconnect +// to avoid spamming the console. Disconnect usually happens +// when developer stops the server. +connection.onclose = function() { + console.info( + 'The development server has disconnected.\nRefresh the page if necessary.' + ); +}; // Remember some state related to hot module replacement. var isFirstCompilation = true; -- GitLab