fix: set update loading state before request
This commit is contained in:
@@ -119,3 +119,5 @@ At the end of a task, normally report only:
|
|||||||
- git status.
|
- git status.
|
||||||
|
|
||||||
Stop after reporting. Do not begin the next task automatically.
|
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.
|
||||||
|
|||||||
@@ -231,6 +231,16 @@ export default function ScenarioForm() {
|
|||||||
const handleUpdate = async (e) => {
|
const handleUpdate = async (e) => {
|
||||||
e.preventDefault();
|
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, {
|
const submission = await submitAnswerForUpdateCase(fetch, {
|
||||||
situationGraph: result?.situationGraph,
|
situationGraph: result?.situationGraph,
|
||||||
previousQuestion: result?.selectedQuestion,
|
previousQuestion: result?.selectedQuestion,
|
||||||
@@ -243,9 +253,6 @@ export default function ScenarioForm() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setUpdateStatus("loading");
|
|
||||||
setUpdateError(null);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const outcome = submission.data;
|
const outcome = submission.data;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user