Skip to content

Commit 58b95f2

Browse files
committed
fix: refactor the onProgress func
1 parent 1ee1507 commit 58b95f2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

package/src/components/MessageInput/FileUploadPreview.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,13 @@ const FileUploadPreviewWithContext = <
177177
};
178178

179179
// The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.
180-
const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {
180+
const onProgress = (index: string, currentTime?: number) => {
181181
setFileUploads((prevFileUploads) =>
182182
prevFileUploads.map((fileUpload) => ({
183183
...fileUpload,
184184
progress:
185185
fileUpload.id === index
186-
? hasEnd
187-
? 1
188-
: currentTime
186+
? currentTime
189187
? currentTime / (fileUpload.duration as number)
190188
: 0
191189
: fileUpload.progress,

0 commit comments

Comments
 (0)