fix: check cached page state in showLoading() before starting MutationObserver
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
- Page may be already rendered when showLoading() is called (fast nav, cached state) - Check .admin-page-hero / .admin-login-page immediately and hide if present - Prevents stuck loading overlay on rapid navigation between pages Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,20 @@ window.taxbaikAdminSession = {
|
||||
const overlay = document.getElementById('blazor-loading');
|
||||
if (!overlay) return;
|
||||
|
||||
// Start observer FIRST so it catches the mutation that brings new content in.
|
||||
// Show overlay immediately
|
||||
overlay.classList.add('show');
|
||||
|
||||
// Check if page is already ready (cached state on fast nav)
|
||||
const pageReady =
|
||||
document.querySelector('.admin-page-hero') !== null ||
|
||||
document.querySelector('.admin-login-page') !== null;
|
||||
if (pageReady) {
|
||||
// Page already rendered, hide immediately
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
// Start observer to catch future mutations
|
||||
if (window._taxbaikLoadingObserver) {
|
||||
window._taxbaikLoadingObserver.disconnect();
|
||||
}
|
||||
@@ -34,9 +47,6 @@ window.taxbaikAdminSession = {
|
||||
subtree: true
|
||||
});
|
||||
|
||||
// Show overlay after observer is active.
|
||||
overlay.classList.add('show');
|
||||
|
||||
// Safety fallback: hide after 3 seconds regardless.
|
||||
if (window._taxbaikLoadingTimeout) {
|
||||
clearTimeout(window._taxbaikLoadingTimeout);
|
||||
|
||||
Reference in New Issue
Block a user