Skip to content

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: clamp panel widths at render time to prevent layout overflow

nash_su873aa96a2f6d
diff --git a/src/components/layout/app-layout.tsx b/src/components/layout/app-layout.tsx
index a5204c8e..100b66ba 100644
--- a/src/components/layout/app-layout.tsx
+++ b/src/components/layout/app-layout.tsx
@@ -87,6 +87,18 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {
[]
)
+ // Clamp widths at render time to guarantee they never overflow the container
+ const hasRightPanel = !!(selectedFile || researchPanelOpen)
+ const handleWidth = 6
+ const totalHandles = hasRightPanel ? handleWidth * 2 : handleWidth
+ const minCenter = 300
+
+ const safeLeftWidth = Math.max(150, Math.min(leftWidth, 500))
+ const maxRight = hasRightPanel
+ ? Math.max(250, (containerRef.current?.getBoundingClientRect().width ?? 1200) - safeLeftWidth - minCenter - totalHandles)
+ : 0
+ const safeRightWidth = hasRightPanel ? Math.max(250, Math.min(rightWidth, maxRight)) : 0
+
return (
<div className="flex h-screen bg-background text-foreground">
<IconSidebar onSwitchProject={onSwitchProject} />
@@ -94,7 +106,7 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {
{/* Left: File tree + Activity */}
<div
className="flex shrink-0 flex-col overflow-hidden border-r"
- style={{ width: leftWidth }}
+ style={{ width: safeLeftWidth }}
>
<div className="flex-1 overflow-hidden">
<SidebarPanel />
@@ -107,12 +119,12 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {
/>
{/* Center: Chat or view (sources/settings/review) */}
- <div className="flex-1 overflow-hidden" style={{ minWidth: 300 }}>
+ <div className="min-w-0 flex-1 overflow-hidden">
<ContentArea />
</div>
{/* Right panels */}
- {(selectedFile || researchPanelOpen) && (
+ {hasRightPanel && (
<>
<div
className="w-1.5 shrink-0 cursor-col-resize bg-border/40 transition-colors hover:bg-primary/30 active:bg-primary/40"
@@ -120,7 +132,7 @@ export function AppLayout({ onSwitchProject }: AppLayoutProps) {
/>
<div
className="flex shrink-0 flex-col overflow-hidden border-l"
- style={{ width: rightWidth }}
+ style={{ width: safeRightWidth }}
>
{/* File preview on top (if file selected) */}
{selectedFile && (