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 {
|
} else {
|
||||||
await backendStore.apiPost("/api/start");
|
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) {
|
} catch (err) {
|
||||||
console.error("Failed to toggle transcription:", err);
|
console.error("Failed to toggle transcription:", err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ export const backendStore = {
|
|||||||
setPort,
|
setPort,
|
||||||
connect: connectWebSocket,
|
connect: connectWebSocket,
|
||||||
disconnect,
|
disconnect,
|
||||||
|
pollStatus,
|
||||||
apiUrl,
|
apiUrl,
|
||||||
apiFetch,
|
apiFetch,
|
||||||
apiGet,
|
apiGet,
|
||||||
|
|||||||
Reference in New Issue
Block a user