Fix "ups" error for 1sec after logout
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
import { ArrowLeft, MessageCircle } from 'lucide-react';
|
import { ArrowLeft, MessageCircle } from 'lucide-react';
|
||||||
@@ -20,6 +21,22 @@ const ErrorPage = ({
|
|||||||
}) => {
|
}) => {
|
||||||
useCaptureException(error);
|
useCaptureException(error);
|
||||||
|
|
||||||
|
// Ignore next.js internal transient navigation errors that occur during auth state changes
|
||||||
|
const isTransientNavigationError =
|
||||||
|
error?.message?.includes('Error in input stream') ||
|
||||||
|
error?.message?.includes('AbortError') ||
|
||||||
|
(error?.name === 'ChunkLoadError');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isTransientNavigationError && typeof window !== 'undefined') {
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
}, [isTransientNavigationError]);
|
||||||
|
|
||||||
|
if (isTransientNavigationError) {
|
||||||
|
return <div />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'flex h-screen flex-1 flex-col'}>
|
<div className={'flex h-screen flex-1 flex-col'}>
|
||||||
<SiteHeader />
|
<SiteHeader />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
import { ArrowLeft, MessageCircle } from 'lucide-react';
|
import { ArrowLeft, MessageCircle } from 'lucide-react';
|
||||||
@@ -21,6 +22,22 @@ const GlobalErrorPage = ({
|
|||||||
}) => {
|
}) => {
|
||||||
useCaptureException(error);
|
useCaptureException(error);
|
||||||
|
|
||||||
|
// Ignore next.js internal transient navigation errors that occur during auth state changes
|
||||||
|
const isTransientNavigationError =
|
||||||
|
error?.message?.includes('Error in input stream') ||
|
||||||
|
error?.message?.includes('AbortError') ||
|
||||||
|
(error?.name === 'ChunkLoadError');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isTransientNavigationError && typeof window !== 'undefined') {
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
}, [isTransientNavigationError]);
|
||||||
|
|
||||||
|
if (isTransientNavigationError) {
|
||||||
|
return <div />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ export function useAuthChangeListener({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.reload();
|
// Redirect to home instead of reloading to avoid state mismatch errors
|
||||||
|
// during the transition
|
||||||
|
window.location.assign('/');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user