From 86a5a4b859e29983d1bcd147e0cb87461ba29bb2 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 27 Aug 2026 10:18:32 +0700 Subject: [PATCH] #2 Silence AmberCallback mount-time console spam (keep flow-error logs) Co-authored-by: shakespeare.diy --- src/components/auth/AmberCallbackHandler.tsx | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/components/auth/AmberCallbackHandler.tsx b/src/components/auth/AmberCallbackHandler.tsx index e7c36fd..50230dc 100644 --- a/src/components/auth/AmberCallbackHandler.tsx +++ b/src/components/auth/AmberCallbackHandler.tsx @@ -34,37 +34,26 @@ export function AmberCallbackHandler() { const [debugInfo, setDebugInfo] = useState(null); useEffect(() => { - // Log on mount for debugging - console.log('[AmberCallback] Component mounted'); - console.log('[AmberCallback] URL:', window.location.href); - console.log('[AmberCallback] Search:', window.location.search); - console.log('[AmberCallback] Pre-captured event:', sessionStorage.getItem('amber_callback_event')); - // If we're already on the /amber-callback route, AmberCallbackPage handles // the processing — this global handler must stay silent to avoid a race. const hashPath = window.location.hash.replace(/^#/, '').split('?')[0]; if (hashPath === '/amber-callback') { - console.log('[AmberCallback] On /amber-callback route — deferring to AmberCallbackPage'); return; } // Check if this is an Amber callback const isCallback = isAmberCallback(); - console.log('[AmberCallback] isAmberCallback():', isCallback); - + if (!isCallback) { return; } - + // Only process once per page load if (hasProcessed.current) { - console.log('[AmberCallback] Already processed, skipping'); return; } hasProcessed.current = true; - console.log('[AmberCallback] Processing Amber callback...'); - // Show debug info temporarily setDebugInfo('Processing Amber login...'); @@ -73,8 +62,7 @@ export function AmberCallbackHandler() { async function processAmberCallback() { const result = getAmberCallbackResult(); - - console.log('[AmberCallback] Result:', result); + setDebugInfo(`Got result: ${result ? result.substring(0, 16) + '...' : 'null'}`); // Clean up URL immediately to prevent re-processing on refresh