mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
remove iframe postmessage
This commit is contained in:
1 parent
d17fc5ddd7
commit
68959e0e77
2 files changed
+2
-62
No files matched your search
@@ -11,17 +11,7 @@ interface ErrorBoundaryProps {
|
||||
fallback?: ReactNode;
|
||||
}
|
||||
|
||||
interface ErrorMessage {
|
||||
type: 'mkstack-error';
|
||||
error: {
|
||||
message: string;
|
||||
stack?: string;
|
||||
componentStack?: string;
|
||||
url: string;
|
||||
timestamp: string;
|
||||
userAgent: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
constructor(props: ErrorBoundaryProps) {
|
||||
@@ -43,26 +33,6 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
|
||||
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||
console.error('Error caught by ErrorBoundary:', error, errorInfo);
|
||||
|
||||
// Send error details via postMessage for iframe embedding
|
||||
const errorMessage: ErrorMessage = {
|
||||
type: 'mkstack-error',
|
||||
error: {
|
||||
message: error.message,
|
||||
stack: error.stack || undefined,
|
||||
componentStack: errorInfo.componentStack || undefined,
|
||||
url: window.location.href,
|
||||
timestamp: new Date().toISOString(),
|
||||
userAgent: navigator.userAgent,
|
||||
},
|
||||
};
|
||||
|
||||
// Send to parent window if in iframe, or broadcast to all
|
||||
if (window.parent !== window) {
|
||||
window.parent.postMessage(errorMessage, '*');
|
||||
} else {
|
||||
window.postMessage(errorMessage, '*');
|
||||
}
|
||||
|
||||
this.setState({
|
||||
error,
|
||||
errorInfo,
|
||||
|
||||
Reference in new issue
Block a user