Fix Stop Transcription button not updating after click
After calling POST /api/stop, the button stayed on "Stop Transcription" because the state update depended on the WebSocket broadcast which can be delayed or missed (event loop threading issue). Fix: poll GET /api/status immediately after start/stop API calls to update the UI state directly, rather than waiting for the WebSocket. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
} else {
|
||||
await backendStore.apiPost("/api/start");
|
||||
}
|
||||
// Poll status to update UI immediately instead of waiting
|
||||
// for WebSocket broadcast (which can be delayed or missed)
|
||||
await backendStore.pollStatus();
|
||||
} catch (err) {
|
||||
console.error("Failed to toggle transcription:", err);
|
||||
} finally {
|
||||
|
||||
@@ -302,6 +302,7 @@ export const backendStore = {
|
||||
setPort,
|
||||
connect: connectWebSocket,
|
||||
disconnect,
|
||||
pollStatus,
|
||||
apiUrl,
|
||||
apiFetch,
|
||||
apiGet,
|
||||
|
||||
Reference in New Issue
Block a user