From be6eaa5951a400ea8ef11605e9225af11a6ec28a Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Thu, 20 Nov 2025 15:50:38 -0800 Subject: [PATCH] Hot Reload: Do not add empty div when diagnostics are empty (1xx) --- src/BuiltInTools/BrowserRefresh/WebSocketScriptInjection.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BuiltInTools/BrowserRefresh/WebSocketScriptInjection.js b/src/BuiltInTools/BrowserRefresh/WebSocketScriptInjection.js index aa8f1fd60f98..57d3b7ab3494 100644 --- a/src/BuiltInTools/BrowserRefresh/WebSocketScriptInjection.js +++ b/src/BuiltInTools/BrowserRefresh/WebSocketScriptInjection.js @@ -267,6 +267,11 @@ setTimeout(async function () { function displayDiagnostics(diagnostics) { document.querySelectorAll('#dotnet-compile-error').forEach(el => el.remove()); + + if (diagnostics.length == 0) { + return; + } + const el = document.body.appendChild(document.createElement('div')); el.id = 'dotnet-compile-error'; el.setAttribute('style', 'z-index:1000000; position:fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); color:black; overflow: scroll;');