fix: scroll to top on survey slide transitions and completion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-05 02:19:27 -05:00
parent 932927b9df
commit 1644278fb1

View File

@@ -199,12 +199,14 @@ export default function SurveyPage() {
if (!res.ok) {
if (res.status === 409) {
setAlreadyCompleted(true)
window.scrollTo({ top: 0, behavior: 'smooth' })
return
}
const errData = await res.json().catch(() => null)
throw new Error(errData?.detail || `Submission failed (${res.status})`)
}
setIsComplete(true)
window.scrollTo({ top: 0, behavior: 'smooth' })
} catch (err) {
setSubmitError(err instanceof Error ? err.message : 'Submission failed. Try copying your responses instead.')
} finally {