-
Notifications
You must be signed in to change notification settings - Fork 176
Persist last used selections on homepage #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The code was calling an undefined function setSavedAgent in the onValueChange handler, causing TypeScript compilation to fail.
View Details
📝 Patch Details
diff --git a/components/task-form.tsx b/components/task-form.tsx
index bfbd04b..021b08b 100644
--- a/components/task-form.tsx
+++ b/components/task-form.tsx
@@ -440,8 +440,6 @@ export function TaskForm({
value={selectedAgent || 'claude'}
onValueChange={(value) => {
setSelectedAgent(value)
- // Save to Jotai atom immediately
- setSavedAgent(value)
}}
disabled={isSubmitting}
>
Analysis
TypeScript compilation failure due to undefined function call
What fails: TypeScript compiler fails on components/task-form.tsx:444:21 due to calling undefined function setSavedAgent
How to reproduce:
pnpm run buildResult:
Type error: Cannot find name 'setSavedAgent'.| const [savedAgent, setSavedAgent] = useAtom(lastSelectedAgentAtom) | ||
| const [selectedAgent, setSelectedAgent] = useState(savedAgent || 'claude') | ||
| const [selectedAgent, setSelectedAgent] = useAtom(lastSelectedAgentAtom) | ||
| const [isAgentInitialized, setIsAgentInitialized] = useState(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isAgentInitialized state variable is created and set but never used anywhere in the component.
View Details
📝 Patch Details
diff --git a/components/task-form.tsx b/components/task-form.tsx
index 2bf77ef..9280459 100644
--- a/components/task-form.tsx
+++ b/components/task-form.tsx
@@ -161,7 +161,6 @@ export function TaskForm({
}: TaskFormProps) {
const [prompt, setPrompt] = useAtom(taskPromptAtom)
const [selectedAgent, setSelectedAgent] = useAtom(lastSelectedAgentAtom)
- const [isAgentInitialized, setIsAgentInitialized] = useState(false)
const [selectedModel, setSelectedModel] = useState<string>(DEFAULT_MODELS.claude)
const [selectedModels, setSelectedModels] = useState<string[]>([])
const [repos, setRepos] = useAtom(githubReposAtomFamily(selectedOwner))
@@ -235,7 +234,6 @@ export function TaskForm({
setSelectedModel(urlModel)
}
}
- setIsAgentInitialized(true)
} else {
// Wait a tick for localStorage to be read by Jotai
const timeoutId = setTimeout(() => {
@@ -243,7 +241,6 @@ export function TaskForm({
// Only set default if still no agent after localStorage load
setSelectedAgent('claude')
}
- setIsAgentInitialized(true)
}, 0)
return () => clearTimeout(timeoutId)
Analysis
Dead code: Unused isAgentInitialized state variable in TaskForm component
What fails: The isAgentInitialized state variable (line 164) is declared with useState(false) but is never read anywhere in the component. It is set to true in two places (lines 238 and 246 in the mount effect) but never referenced in conditional rendering or any other logic.
How to reproduce:
# Run TypeScript compiler with noUnusedLocals flag
pnpm exec tsc --noEmit --noUnusedLocalsResult: TypeScript reports:
components/task-form.tsx(164,10): error TS6133: 'isAgentInitialized' is declared but its value is never read.
Expected: TypeScript compilation should succeed with no unused variable errors. State variables should either be used for their intended purpose or removed entirely.
Fix: Removed the unused state variable declaration and all calls to its setter function (setIsAgentInitialized). The variable appeared to have been intended for gating renders during initialization but was never implemented, leaving it as pure dead code.
No description provided.