From 6dc68d9ae92ab4ca3076a91753a328beb9b79b54 Mon Sep 17 00:00:00 2001 From: Cole Lawrence Date: Wed, 22 Jun 2022 14:36:33 -0400 Subject: [PATCH] fix playground navigation by disabling live-reload for iframed --- packages/playground/devEnv/createEsbuildLiveReloadTools.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/playground/devEnv/createEsbuildLiveReloadTools.ts b/packages/playground/devEnv/createEsbuildLiveReloadTools.ts index 9deccf9..57e09ae 100644 --- a/packages/playground/devEnv/createEsbuildLiveReloadTools.ts +++ b/packages/playground/devEnv/createEsbuildLiveReloadTools.ts @@ -34,6 +34,13 @@ export function createEsbuildLiveReloadTools(): { js: `;(${function liveReloadClientSetup() { // from packages/playground/devEnv/createEsbuildLiveReloadTools.ts function connect() { + if (window.parent !== window) { + console.log( + '%cLive reload disabled for iframed content', + 'color: gray', + ) + return + } try { const es = new EventSource('/esbuild') es.onmessage = (evt) => {