From 2b8a1e3ed170190b7d7d1a89bcde40f88205b551 Mon Sep 17 00:00:00 2001 From: Andrew Prifer <2991360+AndrewPrifer@users.noreply.github.com> Date: Tue, 28 Jun 2022 22:17:37 +0200 Subject: [PATCH] Fix playground live reload multiplying connections on error in Chrome and Safari (#238) --- packages/playground/devEnv/createEsbuildLiveReloadTools.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/playground/devEnv/createEsbuildLiveReloadTools.ts b/packages/playground/devEnv/createEsbuildLiveReloadTools.ts index 57e09ae..9651339 100644 --- a/packages/playground/devEnv/createEsbuildLiveReloadTools.ts +++ b/packages/playground/devEnv/createEsbuildLiveReloadTools.ts @@ -53,7 +53,10 @@ export function createEsbuildLiveReloadTools(): { break } } - es.onerror = attemptConnect + es.onerror = () => { + es.close() + attemptConnect() + } } catch (err) { attemptConnect() }