Skip to content

Commit cf766bf

Browse files
Update hooks and lib utilities
1 parent e8d5238 commit cf766bf

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

hooks/use-task.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use client'
22

3-
import { useState, useEffect } from 'react'
3+
import { useState, useEffect, useCallback } from 'react'
44
import { Task } from '@/lib/tasks'
55

66
export function useTask(taskId: string) {
77
const [task, setTask] = useState<Task | null>(null)
88
const [isLoading, setIsLoading] = useState(true)
99
const [error, setError] = useState<string | null>(null)
1010

11-
const fetchTask = async () => {
11+
const fetchTask = useCallback(async () => {
1212
try {
1313
const response = await fetch(`/api/tasks/${taskId}`)
1414
if (response.ok) {
@@ -27,12 +27,12 @@ export function useTask(taskId: string) {
2727
} finally {
2828
setIsLoading(false)
2929
}
30-
}
30+
}, [taskId])
3131

3232
// Initial fetch
3333
useEffect(() => {
3434
fetchTask()
35-
}, [taskId])
35+
}, [fetchTask, taskId])
3636

3737
// Poll for updates every 5 seconds
3838
useEffect(() => {
@@ -41,7 +41,7 @@ export function useTask(taskId: string) {
4141
}, 5000)
4242

4343
return () => clearInterval(interval)
44-
}, [taskId])
44+
}, [fetchTask, taskId])
4545

4646
return { task, isLoading, error, refetch: fetchTask }
4747
}

lib/llm-guide.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,16 @@ export function getLLMSection(content: string, sectionName: string): string {
2020
return section ? section.trim() : ''
2121
}
2222

23-
/**
24-
* Gets template-specific instructions from the LLM guide
25-
*/
2623
export function getTemplateInstructions(templateId: string): string {
2724
const guide = getLLMGuide()
2825

29-
// Find template-specific instructions section
3026
const sections = guide.split('====')
3127
const templateSection = sections.find(s =>
3228
s.trim().includes('TEMPLATE-SPECIFIC INSTRUCTIONS')
3329
)
3430

3531
if (!templateSection) return ''
3632

37-
// Extract specific template instructions
3833
const templateName = templateId.replace('-', ' ').toLowerCase()
3934
const lines = templateSection.split('\n')
4035
const startIndex = lines.findIndex(line =>

0 commit comments

Comments
 (0)