-
-
@@ -228,7 +223,7 @@ Build: @BuildVersion
localizeContent();
}
- document.addEventListener('DOMContentLoaded', initializeLocalization);
+ // Initialize localization
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeLocalization);
} else {
@@ -290,10 +285,19 @@ Build: @BuildVersion
};
// Boot failure recovery for stale service worker cache or network issues
- let bootFailureHandled = false;
+ // Use sessionStorage to prevent redirect loops - flag persists across page reloads within session
+ const BOOT_FAILURE_KEY = 'aliasvault_boot_failure_handled';
+ let bootFailureHandled = sessionStorage.getItem(BOOT_FAILURE_KEY) === 'true';
+
async function handleBlazorBootFailure() {
- if (bootFailureHandled) return;
+ if (bootFailureHandled) {
+ // Already attempted recovery once this session, don't loop
+ console.warn('AliasVault: Boot failure recovery already attempted. Showing error to user.');
+ showError('Failed to load application. Please try clearing your browser cache and refreshing the page.');
+ return;
+ }
bootFailureHandled = true;
+ sessionStorage.setItem(BOOT_FAILURE_KEY, 'true');
console.info('AliasVault: Blazor boot failure detected. Clearing caches and reloading...');
@@ -317,6 +321,11 @@ Build: @BuildVersion
window.location.replace(url.toString());
}
+ // Clear the boot failure flag on successful Blazor start
+ function clearBootFailureFlag() {
+ sessionStorage.removeItem(BOOT_FAILURE_KEY);
+ }
+
// Detect Blazor boot failures and trigger recovery
function isBlazorBootError(message) {
const bootErrorPatterns = [
@@ -373,7 +382,10 @@ Build: @BuildVersion
configureRuntime: runtime => runtime.withConfig({
loadAllSatelliteResources: true
})
- })
+ }).then(function() {
+ // Blazor started successfully, clear any previous set boot failure flag
+ clearBootFailureFlag();
+ });