From e62d381ed249400e4f8c8eb9203b4aff1686a0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Fri, 21 Nov 2025 12:33:55 -0800 Subject: [PATCH] Hot Reload: Do not add empty div when diagnostics are empty (1xx) (#51837) --- 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;');