SurfSense/surfsense_web/components/editor/plate-error-boundary.tsx
Anish Sarkar 4658130bb8 feat(editor): update editor limits and add error boundary
- Reduced maximum document size for the editor from 5MB to 1MB.
- Introduced a new line limit of 5000 for documents in the editor.
- Implemented a PlateErrorBoundary component to handle rendering errors gracefully in the editor panel.
- Updated logic in the editor panel to check both size and line count for document limits.
2026-06-17 12:11:31 +05:30

34 lines
625 B
TypeScript

"use client";
import { Component, type ReactNode } from "react";
interface PlateErrorBoundaryProps {
children: ReactNode;
fallback: ReactNode;
}
interface PlateErrorBoundaryState {
hasError: boolean;
}
export class PlateErrorBoundary extends Component<
PlateErrorBoundaryProps,
PlateErrorBoundaryState
> {
constructor(props: PlateErrorBoundaryProps) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError(): PlateErrorBoundaryState {
return { hasError: true };
}
render() {
if (this.state.hasError) {
return this.props.fallback;
}
return this.props.children;
}
}