mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-03 03:14:57 -05:00
fix: clear storage when answers blank and remove inline comments
- Clear localStorage when all answers are deleted to prevent stale data on reload - Remove inline comments to comply with no-comments guideline
This commit is contained in:
@@ -68,13 +68,13 @@ export function ClarificationQuestionsWidget({
|
||||
if (!storageKey) return;
|
||||
|
||||
const hasAnswers = Object.values(answers).some((v) => v.trim());
|
||||
if (hasAnswers) {
|
||||
try {
|
||||
try {
|
||||
if (hasAnswers) {
|
||||
localStorage.setItem(storageKey, JSON.stringify(answers));
|
||||
} catch {
|
||||
// Ignore storage errors
|
||||
} else {
|
||||
localStorage.removeItem(storageKey);
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}, [answers, sessionId]);
|
||||
|
||||
const handleAnswerChange = useCallback((keyword: string, value: string) => {
|
||||
@@ -93,15 +93,12 @@ export function ClarificationQuestionsWidget({
|
||||
if (storageKey) {
|
||||
try {
|
||||
localStorage.removeItem(storageKey);
|
||||
} catch {
|
||||
// Ignore storage errors
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
const allAnswered = questions.every((q) => answers[q.keyword]?.trim());
|
||||
|
||||
// Show submitted state after answers are submitted
|
||||
if (isSubmitted) {
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user