From 3a83944006b14bce4d69c610e8658d30afde0289 Mon Sep 17 00:00:00 2001 From: robbond Date: Mon, 3 Aug 2026 19:01:04 +0100 Subject: [PATCH] fix: set update loading state before request --- .claude/working-rules.md | 2 ++ components/scenario-form.jsx | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.claude/working-rules.md b/.claude/working-rules.md index fb42dd6..eb44734 100644 --- a/.claude/working-rules.md +++ b/.claude/working-rules.md @@ -119,3 +119,5 @@ At the end of a task, normally report only: - git status. Stop after reporting. Do not begin the next task automatically. + +When a task is interrupted by output limits, resume with a narrowly scoped repair prompt rather than restating the entire original brief. diff --git a/components/scenario-form.jsx b/components/scenario-form.jsx index a3c8458..2f62781 100644 --- a/components/scenario-form.jsx +++ b/components/scenario-form.jsx @@ -231,6 +231,16 @@ export default function ScenarioForm() { const handleUpdate = async (e) => { e.preventDefault(); + // Guard empty answer before showing loading state + if (!answer?.trim()) { + setUpdateStatus("error"); + setUpdateError({ error: "Please enter an answer before updating." }); + return; + } + + setUpdateStatus("loading"); + setUpdateError(null); + const submission = await submitAnswerForUpdateCase(fetch, { situationGraph: result?.situationGraph, previousQuestion: result?.selectedQuestion, @@ -243,9 +253,6 @@ export default function ScenarioForm() { return; } - setUpdateStatus("loading"); - setUpdateError(null); - try { const outcome = submission.data;