mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-07 02:00:02 +00:00
Update SkipSegmentsView.tsx
This commit is contained in:
parent
12f97e7501
commit
9cc7f272e7
1 changed files with 14 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/buttons/Button";
|
||||
|
|
@ -20,6 +20,18 @@ export function SkipSegmentsView({ id }: { id: string }) {
|
|||
const { setCurrentOverlay } = useOverlayStack();
|
||||
const [showSubmissionForm, setShowSubmissionForm] = useState(false);
|
||||
|
||||
// Memoize the segment object to prevent re-renders from clearing form inputs
|
||||
const segmentData = useMemo(
|
||||
() => ({
|
||||
type: "intro" as const,
|
||||
start_ms: null,
|
||||
end_ms: null,
|
||||
confidence: null,
|
||||
submission_count: 0,
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
const handleSeek = (seconds: number) => {
|
||||
display?.setTime(seconds);
|
||||
};
|
||||
|
|
@ -108,13 +120,7 @@ export function SkipSegmentsView({ id }: { id: string }) {
|
|||
|
||||
{showSubmissionForm && tidbKey && (
|
||||
<TIDBSubmissionForm
|
||||
segment={{
|
||||
type: "intro",
|
||||
start_ms: null,
|
||||
end_ms: null,
|
||||
confidence: null,
|
||||
submission_count: 0,
|
||||
}}
|
||||
segment={segmentData}
|
||||
onSuccess={() => {
|
||||
setShowSubmissionForm(false);
|
||||
setCurrentOverlay("tidb-submission-success");
|
||||
|
|
|
|||
Loading…
Reference in a new issue