#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,37 +34,26 @@ export function AmberCallbackHandler() {
|
||||||
const [debugInfo, setDebugInfo] = useState<string | null>(null);
|
const [debugInfo, setDebugInfo] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
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
|
// If we're already on the /amber-callback route, AmberCallbackPage handles
|
||||||
// the processing — this global handler must stay silent to avoid a race.
|
// the processing — this global handler must stay silent to avoid a race.
|
||||||
const hashPath = window.location.hash.replace(/^#/, '').split('?')[0];
|
const hashPath = window.location.hash.replace(/^#/, '').split('?')[0];
|
||||||
if (hashPath === '/amber-callback') {
|
if (hashPath === '/amber-callback') {
|
||||||
console.log('[AmberCallback] On /amber-callback route — deferring to AmberCallbackPage');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this is an Amber callback
|
// Check if this is an Amber callback
|
||||||
const isCallback = isAmberCallback();
|
const isCallback = isAmberCallback();
|
||||||
console.log('[AmberCallback] isAmberCallback():', isCallback);
|
|
||||||
|
|
||||||
if (!isCallback) {
|
if (!isCallback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only process once per page load
|
// Only process once per page load
|
||||||
if (hasProcessed.current) {
|
if (hasProcessed.current) {
|
||||||
console.log('[AmberCallback] Already processed, skipping');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hasProcessed.current = true;
|
hasProcessed.current = true;
|
||||||
|
|
||||||
console.log('[AmberCallback] Processing Amber callback...');
|
|
||||||
|
|
||||||
// Show debug info temporarily
|
// Show debug info temporarily
|
||||||
setDebugInfo('Processing Amber login...');
|
setDebugInfo('Processing Amber login...');
|
||||||
|
|
||||||
|
|
@ -73,8 +62,7 @@ export function AmberCallbackHandler() {
|
||||||
|
|
||||||
async function processAmberCallback() {
|
async function processAmberCallback() {
|
||||||
const result = getAmberCallbackResult();
|
const result = getAmberCallbackResult();
|
||||||
|
|
||||||
console.log('[AmberCallback] Result:', result);
|
|
||||||
setDebugInfo(`Got result: ${result ? result.substring(0, 16) + '...' : 'null'}`);
|
setDebugInfo(`Got result: ${result ? result.substring(0, 16) + '...' : 'null'}`);
|
||||||
|
|
||||||
// Clean up URL immediately to prevent re-processing on refresh
|
// Clean up URL immediately to prevent re-processing on refresh
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue