LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
fix: add ErrorBoundary around content and right panels
nash_subf175a74fee0
diff --git a/src/components/error-boundary.tsx b/src/components/error-boundary.tsxnew file mode 100644index 00000000..0abd9c21--- /dev/null+++ b/src/components/error-boundary.tsx@@ -0,0 +1,45 @@+import { Component, type ReactNode } from "react"++interface Props {+ children: ReactNode+ fallback?: ReactNode+}++interface State {+ hasError: boolean+ error: Error | null+}++export class ErrorBoundary extends Component<Props, State> {+ constructor(props: Props) {+ super(props)+ this.state = { hasError: false, error: null }+ }++ static getDerivedStateFromError(error: Error): State {+ return { hasError: true, error }+ }++ componentDidCatch(error: Error, info: React.ErrorInfo) {+ console.error("ErrorBoundary caught:", error, info.componentStack)+ }++ render() {+ if (this.state.hasError) {+ if (this.props.fallback) return this.props.fallback+ return (+ <div className="flex h-full flex-col items-center justify-center gap-3 p-6 text-sm text-muted-foreground">+ <p className="text-destructive font-medium">Something went wrong</p>+ <p className="text-xs max-w-md text-center">{this.state.error?.message}</p>+ <button+ className="rounded border px-3 py-1 text-xs hover:bg-muted"+ onClick={() => this.setState({ hasError: false, error: null })}+ >+ Retry+ </button>+ </div>+ )+ }+ return this.props.children+ }+}diff --git a/src/components/layout/app-layout.tsx b/src/components/layout/app-layout.tsxindex f7406cfa..afc70ecf 100644--- a/src/components/layout/app-layout.tsx+++ b/src/components/layout/app-layout.tsx@@ -9,6 +9,7 @@ import { PreviewPanel } from "./preview-panel"import { ResearchPanel } from "./research-panel"import { ActivityPanel } from "./activity-panel"import { useResearchStore } from "@/stores/research-store"+import { ErrorBoundary } from "@/components/error-boundary"interface AppLayoutProps {onSwitchProject: () => void@@ -101,7 +102,9 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {{/* Center: Chat or view (sources/settings/review) */}<div className="min-w-0 flex-1 overflow-hidden">- <ContentArea />+ <ErrorBoundary>+ <ContentArea />+ </ErrorBoundary></div>{/* Right panels */}@@ -115,18 +118,20 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {className="flex shrink-0 flex-col overflow-hidden border-l"style={{ width: rightWidth }}>- {/* File preview on top (if file selected) */}- {selectedFile && (- <div className={researchPanelOpen ? "flex-1 overflow-hidden border-b" : "flex-1 overflow-hidden"}>- <PreviewPanel />- </div>- )}- {/* Research panel on bottom (if open) */}- {researchPanelOpen && (- <div className={selectedFile ? "h-1/2 shrink-0 overflow-hidden" : "flex-1 overflow-hidden"}>- <ResearchPanel />- </div>- )}+ <ErrorBoundary>+ {/* File preview on top (if file selected) */}+ {selectedFile && (+ <div className={researchPanelOpen ? "flex-1 overflow-hidden border-b" : "flex-1 overflow-hidden"}>+ <PreviewPanel />+ </div>+ )}+ {/* Research panel on bottom (if open) */}+ {researchPanelOpen && (+ <div className={selectedFile ? "h-1/2 shrink-0 overflow-hidden" : "flex-1 overflow-hidden"}>+ <ResearchPanel />+ </div>+ )}+ </ErrorBoundary></div></>)}