Add mobile Safari reload loop prevention for auth pages
All checks were successful
Build And Push Image / docker (push) Successful in 3m2s
All checks were successful
Build And Push Image / docker (push) Successful in 3m2s
- Implement comprehensive reload loop prevention utility - Add initialization checks to setup-password, verify, and signup pages - Include timeout protection and error handling for config loading - Add fallback defaults to prevent page failures on mobile devices - Document mobile reload loop prevention system
This commit is contained in:
@@ -312,8 +312,17 @@ const setupPassword = async () => {
|
||||
};
|
||||
|
||||
// Component initialization - Safari iOS reload loop prevention
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
console.log('[setup-password] Password setup page loaded for:', email.value);
|
||||
|
||||
// CRITICAL: Check reload loop prevention first
|
||||
const { initReloadLoopPrevention } = await import('~/utils/reload-loop-prevention');
|
||||
const canLoad = initReloadLoopPrevention('setup-password-page');
|
||||
|
||||
if (!canLoad) {
|
||||
console.error('[setup-password] Page load blocked by reload loop prevention system');
|
||||
return; // Stop all initialization if blocked
|
||||
}
|
||||
|
||||
// Apply mobile Safari optimizations early
|
||||
if (deviceInfo.isMobileSafari) {
|
||||
|
||||
@@ -386,9 +386,18 @@ const retryVerification = async () => {
|
||||
};
|
||||
|
||||
// Component initialization - Safari iOS reload loop prevention
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
console.log('[auth/verify] Component mounted with token:', token?.substring(0, 20) + '...');
|
||||
|
||||
// CRITICAL: Check reload loop prevention first
|
||||
const { initReloadLoopPrevention } = await import('~/utils/reload-loop-prevention');
|
||||
const canLoad = initReloadLoopPrevention('verify-page');
|
||||
|
||||
if (!canLoad) {
|
||||
console.error('[auth/verify] Page load blocked by reload loop prevention system');
|
||||
return; // Stop all initialization if blocked
|
||||
}
|
||||
|
||||
// Apply mobile Safari optimizations early
|
||||
if (deviceInfo.isMobileSafari) {
|
||||
applyMobileSafariOptimizations();
|
||||
|
||||
@@ -430,9 +430,19 @@ let initialized = false;
|
||||
onMounted(async () => {
|
||||
// Prevent multiple initializations
|
||||
if (initialized || typeof window === 'undefined') return;
|
||||
initialized = true;
|
||||
|
||||
console.log('[signup] Initializing signup page...');
|
||||
console.log('[signup] Starting signup page initialization...');
|
||||
|
||||
// CRITICAL: Check reload loop prevention first
|
||||
const { initReloadLoopPrevention } = await import('~/utils/reload-loop-prevention');
|
||||
const canLoad = initReloadLoopPrevention('signup-page');
|
||||
|
||||
if (!canLoad) {
|
||||
console.error('[signup] Page load blocked by reload loop prevention system');
|
||||
return; // Stop all initialization if blocked
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
|
||||
// Apply mobile Safari optimizations early
|
||||
if (deviceInfo.isMobileSafari) {
|
||||
@@ -446,7 +456,14 @@ onMounted(async () => {
|
||||
try {
|
||||
// Load configs using cached utility (prevents repeated API calls)
|
||||
console.log('[signup] Loading configurations...');
|
||||
const configs = await loadAllConfigs();
|
||||
|
||||
// Add timeout to prevent hanging on mobile
|
||||
const configPromise = loadAllConfigs();
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Config loading timeout')), 10000);
|
||||
});
|
||||
|
||||
const configs = await Promise.race([configPromise, timeoutPromise]) as any;
|
||||
|
||||
// Set static config values
|
||||
if (configs.recaptcha?.siteKey) {
|
||||
@@ -457,6 +474,8 @@ onMounted(async () => {
|
||||
setTimeout(() => {
|
||||
loadRecaptchaScript(recaptchaSiteKey.value);
|
||||
}, 100);
|
||||
} else {
|
||||
console.log('[signup] No reCAPTCHA site key - continuing without reCAPTCHA');
|
||||
}
|
||||
|
||||
if (configs.registration) {
|
||||
@@ -464,12 +483,27 @@ onMounted(async () => {
|
||||
iban = configs.registration.iban || 'MC58 1756 9000 0104 0050 1001 860';
|
||||
accountHolder = configs.registration.accountHolder || 'ASSOCIATION MONACO USA';
|
||||
console.log('[signup] Registration config loaded');
|
||||
} else {
|
||||
console.log('[signup] Using default registration config');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// Prevent any errors from bubbling up and causing reload
|
||||
console.warn('[signup] Configuration loading error (using defaults):', error);
|
||||
// Use default values which are already set above
|
||||
|
||||
// Use default values - don't let config errors break the page
|
||||
membershipFee = 150;
|
||||
iban = 'MC58 1756 9000 0104 0050 1001 860';
|
||||
accountHolder = 'ASSOCIATION MONACO USA';
|
||||
|
||||
// Clear any hanging loading states
|
||||
if (typeof window !== 'undefined') {
|
||||
const globalCache = (window as any).__configCache;
|
||||
if (globalCache) {
|
||||
globalCache.recaptchaLoading = false;
|
||||
globalCache.registrationLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[signup] Signup page initialization complete');
|
||||
|
||||
Reference in New Issue
Block a user