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: move useCallback hooks before conditional return to fix Rules of Hooks

nash_su8bc0274a9e7b
diff --git a/src/components/layout/activity-panel.tsx b/src/components/layout/activity-panel.tsx
index 8659a54c..8fbb5935 100644
--- a/src/components/layout/activity-panel.tsx
+++ b/src/components/layout/activity-panel.tsx
@@ -51,6 +51,17 @@ export function ActivityPanel() {
const queueSummary = getQueueSummary()
const hasQueue = queueSummary.total > 0
+ // All hooks must be before any conditional return
+ const handleRetry = useCallback((taskId: string) => {
+ if (!project) return
+ retryTask(normalizePath(project.path), taskId)
+ }, [project])
+
+ const handleCancel = useCallback((taskId: string) => {
+ if (!project) return
+ cancelTask(normalizePath(project.path), taskId)
+ }, [project])
+
// Auto-expand when a new task starts running
useEffect(() => {
if (runningCount > 0 && prevRunningRef.current === 0) {
@@ -82,16 +93,6 @@ export function ActivityPanel() {
const isActive = runningCount > 0 || queueSummary.processing > 0 || queueSummary.pending > 0
- const handleRetry = useCallback((taskId: string) => {
- if (!project) return
- retryTask(normalizePath(project.path), taskId)
- }, [project])
-
- const handleCancel = useCallback((taskId: string) => {
- if (!project) return
- cancelTask(normalizePath(project.path), taskId)
- }, [project])
-
return (
<div className="border-t bg-muted/30">
<button