mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
file upload real-time state management fix
This commit is contained in:
@@ -24,10 +24,16 @@ const TranscriptUpload = (details: TranscriptUpload) => {
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const [status, setStatus] = useState(
|
||||
const [status_, setStatus] = useState(
|
||||
webSockets.status.value || transcript.response?.status || "idle",
|
||||
);
|
||||
|
||||
// status is obviously done if we have transcript
|
||||
const status =
|
||||
!transcript.loading && transcript.response?.status === "ended"
|
||||
? transcript.response?.status
|
||||
: status_;
|
||||
|
||||
useEffect(() => {
|
||||
if (!transcriptStarted && webSockets.transcriptTextLive.length !== 0)
|
||||
setTranscriptStarted(true);
|
||||
@@ -35,8 +41,11 @@ const TranscriptUpload = (details: TranscriptUpload) => {
|
||||
|
||||
useEffect(() => {
|
||||
//TODO HANDLE ERROR STATUS BETTER
|
||||
// TODO deprecate webSockets.status.value / depend on transcript.response?.status from query lib
|
||||
const newStatus =
|
||||
webSockets.status.value || transcript.response?.status || "idle";
|
||||
transcript.response?.status === "ended"
|
||||
? "ended"
|
||||
: webSockets.status.value || transcript.response?.status || "idle";
|
||||
setStatus(newStatus);
|
||||
if (newStatus && (newStatus == "ended" || newStatus == "error")) {
|
||||
console.log(newStatus, "redirecting");
|
||||
|
||||
26
www/app/reflector-api.d.ts
vendored
26
www/app/reflector-api.d.ts
vendored
@@ -566,8 +566,17 @@ export interface components {
|
||||
user_id: string | null;
|
||||
/** Name */
|
||||
name: string;
|
||||
/** Status */
|
||||
status: string;
|
||||
/**
|
||||
* Status
|
||||
* @enum {string}
|
||||
*/
|
||||
status:
|
||||
| "idle"
|
||||
| "uploaded"
|
||||
| "recording"
|
||||
| "processing"
|
||||
| "error"
|
||||
| "ended";
|
||||
/** Locked */
|
||||
locked: boolean;
|
||||
/** Duration */
|
||||
@@ -611,8 +620,17 @@ export interface components {
|
||||
user_id: string | null;
|
||||
/** Name */
|
||||
name: string;
|
||||
/** Status */
|
||||
status: string;
|
||||
/**
|
||||
* Status
|
||||
* @enum {string}
|
||||
*/
|
||||
status:
|
||||
| "idle"
|
||||
| "uploaded"
|
||||
| "recording"
|
||||
| "processing"
|
||||
| "error"
|
||||
| "ended";
|
||||
/** Locked */
|
||||
locked: boolean;
|
||||
/** Duration */
|
||||
|
||||
Reference in New Issue
Block a user