fraudTech commited on
Commit
39b53b1
·
1 Parent(s): 5f0282c

fixed stop button issues

Browse files
Files changed (1) hide show
  1. web/src/App.tsx +8 -3
web/src/App.tsx CHANGED
@@ -1200,13 +1200,18 @@ function App() {
1200
  )
1201
  );
1202
  } finally {
1203
- // Only clean up if this is still the active request and it wasn't aborted
1204
- if (!wasAborted && myRequestId === requestIdRef.current) {
 
 
 
1205
  setIsLoading(false);
1206
  setIsGenerating(false);
1207
- setResponseComplete(true);
1208
  setStatusMessage('');
1209
  abortControllerRef.current = null;
 
 
 
1210
  }
1211
  }
1212
  };
 
1200
  )
1201
  );
1202
  } finally {
1203
+ // Always clean up loading state for this request — even on abort.
1204
+ // handleStopGeneration schedules the same updates synchronously, but
1205
+ // React state updates are async; clearing here as well guarantees the
1206
+ // UI unlocks regardless of timing so the user can send a new message.
1207
+ if (myRequestId === requestIdRef.current) {
1208
  setIsLoading(false);
1209
  setIsGenerating(false);
 
1210
  setStatusMessage('');
1211
  abortControllerRef.current = null;
1212
+ if (!wasAborted) {
1213
+ setResponseComplete(true);
1214
+ }
1215
  }
1216
  }
1217
  };