diff --git a/src/components/PreviewContent.tsx b/src/components/PreviewContent.tsx index 15a8b52..5e07a59 100644 --- a/src/components/PreviewContent.tsx +++ b/src/components/PreviewContent.tsx @@ -20,6 +20,7 @@ import { MagicWandIcon } from "@radix-ui/react-icons" import { ErrorBoundary } from "react-error-boundary" import { ErrorTabContent } from "./ErrorTabContent" import { cn } from "@/lib/utils" +import { useCallback } from "react" export interface PreviewContentProps { code: string @@ -50,9 +51,17 @@ export const PreviewContent = ({ errorMessage, circuitJson, }: PreviewContentProps) => { + const [activeTab, setActiveTab] = useState("pcb") + + useEffect(() => { + if (errorMessage) { + setActiveTab("error") + } + }, [errorMessage]) + return (