feat(frontend): keep focus, field errors and unsent answers on the minimal path

This commit is contained in:
shira committed 2026-10-09 21:32:55 +03:00
1 parent d4903a3796
commit c94434cd09
12 files changed
+1174 -18

No files matched your search

@@ -44,6 +44,7 @@ import {
import {
AnswerForm,
buildAnswerSubmission,
clearAnswerDraft,
newIdempotencyKey,
submitPendingAnswerCommand,
} from "../../../features/answer-assessment";
@@ -325,6 +326,7 @@ function AssessmentAttemptContent({ attemptId }: { attemptId: string }) {
}
if (outcome.kind === "rejected") throw outcome.error;
const saved = outcome.attempt;
clearAnswerDraft(currentAttemptId, command.itemId);
const key = assessmentQueryKeys.attempt(currentActor, currentAttemptId);
queryClient.setQueryData<AssessmentAttempt>(key, (current) =>
current && current.version > saved.version ? current : saved,
@@ -604,6 +606,7 @@ function AssessmentAttemptContent({ attemptId }: { attemptId: string }) {
<p className={attemptStyles.prompt}>{currentItem.prompt}</p>
<AnswerForm
key={currentItem.id}
attemptId={attempt.id}
item={currentItem}
isSaving={answerBusy}
retryable={Boolean(pendingAnswer && pendingAnswer.itemId === currentItem.id)}