fix: ensure loading overlay renders during analyse
This commit is contained in:
@@ -284,8 +284,8 @@ export default function ScenarioForm() {
|
|||||||
setUpdateError(null);
|
setUpdateError(null);
|
||||||
setCurrentUnderstanding(null);
|
setCurrentUnderstanding(null);
|
||||||
|
|
||||||
// Allow React to render the loading state before awaiting (prevents batching away with instant mocks)
|
// Force a DOM flush so loading state renders before awaiting (prevents instant mocks from swallowing it)
|
||||||
await new Promise(r => setTimeout(r, 0));
|
await new Promise(r => requestAnimationFrame(() => setTimeout(r, 50)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await submitScenarioForStartCase(MOCK_ENABLED ? mockFetch : fetch, scenario);
|
const res = await submitScenarioForStartCase(MOCK_ENABLED ? mockFetch : fetch, scenario);
|
||||||
@@ -323,8 +323,8 @@ export default function ScenarioForm() {
|
|||||||
setUpdateError(null);
|
setUpdateError(null);
|
||||||
setLastSubmittedAnswer(answer.trim());
|
setLastSubmittedAnswer(answer.trim());
|
||||||
|
|
||||||
// Allow React to render the loading state before awaiting (prevents batching away with instant mocks)
|
// Force a DOM flush so loading state renders before awaiting (prevents instant mocks from swallowing it)
|
||||||
await new Promise(r => setTimeout(r, 0));
|
await new Promise(r => requestAnimationFrame(() => setTimeout(r, 50)));
|
||||||
|
|
||||||
const submission = await submitAnswerForUpdateCase(MOCK_ENABLED ? mockFetch : fetch, {
|
const submission = await submitAnswerForUpdateCase(MOCK_ENABLED ? mockFetch : fetch, {
|
||||||
situationGraph: result?.situationGraph,
|
situationGraph: result?.situationGraph,
|
||||||
@@ -449,7 +449,7 @@ export default function ScenarioForm() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── Main result workspace ─────────────────────── */}
|
{/* ── Main result workspace ─────────────────────── */}
|
||||||
{(status === "success" || status === "error") && (
|
{((status === "success" || status === "error") && status !== "loading") && (
|
||||||
<ReasoningWorkspace
|
<ReasoningWorkspace
|
||||||
scenario={scenario}
|
scenario={scenario}
|
||||||
status={status}
|
status={status}
|
||||||
|
|||||||
Reference in New Issue
Block a user