Part of https://www.notion.so/Laconic-Mainnet-Plan-1eca6b22d47280569cd0d1e6d711d949 Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Reviewed-on: #5 Co-authored-by: shreerang <shreerang@noreply.git.vdb.to> Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
39 lines
968 B
TypeScript
39 lines
968 B
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
// This component will suppress Next.js error overlay in development
|
|
export default function ErrorBoundary() {
|
|
useEffect(() => {
|
|
// This targets the Next.js error overlay in development
|
|
const errorOverlay = document.querySelector('nextjs-portal');
|
|
if (errorOverlay) {
|
|
errorOverlay.remove();
|
|
}
|
|
|
|
// Apply style to hide the error icon in the bottom right
|
|
const style = document.createElement('style');
|
|
style.textContent = `
|
|
/* Hide Next.js error overlay and icon */
|
|
nextjs-portal {
|
|
display: none !important;
|
|
}
|
|
|
|
/* Specifically target the error popup button */
|
|
[data-nextjs-dialog-overlay],
|
|
[data-nextjs-toast],
|
|
[data-nextjs-codeframe] {
|
|
display: none !important;
|
|
}
|
|
`;
|
|
document.head.appendChild(style);
|
|
|
|
// Cleanup
|
|
return () => {
|
|
document.head.removeChild(style);
|
|
};
|
|
}, []);
|
|
|
|
return null;
|
|
}
|