Fix: Loading screen now waits for Blazor.start() on all pages

Problem:
- Loading screen was hiding immediately without waiting for Blazor
- Page detection logic was too restrictive (only /blazor paths)
- Most admin pages don't have Blazor components, so screen hid instantly

Solution:
- Blazor Server is loaded on ALL admin pages via _Layout.cshtml
- Removed restrictive path checking (was checking for /blazor or components)
- Now always calls Blazor.start() and waits for SignalR connection
- Loading screen properly shows while SignalR establishes connection

Expected behavior:
- First load: Screen shows → Blazor connects → Screen fades out
- Console: "Starting Blazor Server..." → "Started successfully" → "Hiding"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
SysAdmin 2025-10-06 11:54:53 +01:00
parent db2443c7ac
commit 0a08d1a943

View File

@ -11,10 +11,8 @@ document.addEventListener('DOMContentLoaded', async function() {
console.log('Blazor: Showing loading screen for first load');
}
// Check if we're on a page that should use Blazor
const blazorContainers = document.querySelectorAll('[data-blazor-component]');
if (blazorContainers.length > 0 || window.location.pathname.includes('/Admin/Products/Blazor') || window.location.pathname.includes('/blazor')) {
// Blazor Server is available on all Admin pages, so always start it
// The blazor.server.js script is already loaded in _Layout.cshtml
try {
console.log('Blazor: Starting Blazor Server...');
@ -46,10 +44,6 @@ document.addEventListener('DOMContentLoaded', async function() {
console.error('Blazor: Failed to start:', error);
hideLoadingScreen();
}
} else {
// Not a Blazor page, hide loading screen immediately
hideLoadingScreen();
}
});
// Loading screen management