From e303f3757299f3bedeae36de6015ec8409e72609 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 30 Dec 2017 10:31:34 -0500 Subject: [PATCH] Fix React hot module reloading --- src/index.js | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index d17da17..51d9366 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,13 @@ import Nav from './ui/navigation'; import Main from './ui/main'; import Connection from './ui/connection'; +let skip_init = false; + export function initialize(uri) { + if (skip_init) { + skip_init = false; + return; + } store.dispatch(socket_uri(uri)); store.dispatch(socket_update(SOCKET_STATE.CONNECTING)); ws_init(uri, () => { @@ -29,17 +35,28 @@ export function initialize(uri) { }); } -ReactDOM.render( - - -
-