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:
Zamil Majdy
2026-01-30 12:07:33 -06:00
parent a04c1fa978
commit 18abe18999

View File

@@ -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