#2 Silence AmberCallback mount-time console spam (keep flow-error logs)
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
3fd82f2425
commit
86a5a4b859
1 changed files with 3 additions and 15 deletions
|
|
@ -34,23 +34,15 @@ export function AmberCallbackHandler() {
|
|||
const [debugInfo, setDebugInfo] = useState<string | null>(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;
|
||||
|
|
@ -58,13 +50,10 @@ export function AmberCallbackHandler() {
|
|||
|
||||
// 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...');
|
||||
|
||||
|
|
@ -74,7 +63,6 @@ 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue