Skip to content

Commit b62b7fd

Browse files
committed
sparate handle done and handle cancel..
1 parent 25bb164 commit b62b7fd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/frontend/components/FileList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default memo(function FileList() {
1616
upload: { proceedUpload, uploadStatus, totalProgress },
1717
props: { mini, dark, classNames },
1818
handleDone,
19+
handleCancel,
1920
} = useRootContext()
2021

2122
return (
@@ -28,7 +29,7 @@ export default memo(function FileList() {
2829
},
2930
)}
3031
>
31-
<MainBoxHeader handleCancel={handleDone} />
32+
<MainBoxHeader handleCancel={handleCancel} />
3233

3334
<MyAnimatePresence>
3435
<motion.div

src/frontend/context/RootContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export interface IRootContext {
7171

7272
handleFileRemove: (fileId: string) => void
7373
handleDone: () => void
74+
handleCancel: () => void
7475

7576
oneDriveConfigs?: OneDriveConfigs
7677
googleDriveConfigs?: GoogleDriveConfigs

src/frontend/hooks/useRootProvider.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,16 @@ export default function useRootProvider({
304304
return
305305
}
306306
}
307-
308307
const handleDone = useCallback(() => {
309308
onDoneClicked()
309+
handleCancel()
310+
}, [])
311+
312+
const handleCancel = useCallback(() => {
310313
setUploadStatus(UploadStatus.PENDING)
311314
setSelectedFilesMap(new Map())
312315
setFilesProgressMap({})
313316
}, [])
314-
315317
useEffect(() => {
316318
if (!toastContainerId && (!errorHandler || !warningHandler))
317319
setToastContainerId(uuid())
@@ -328,6 +330,7 @@ export default function useRootProvider({
328330
dynamicUpload,
329331
dynamicallyReplaceFiles,
330332
handleDone,
333+
handleCancel,
331334
handleFileRemove,
332335
oneDriveConfigs: driveConfigs?.oneDrive,
333336
googleDriveConfigs: driveConfigs?.googleDrive,

0 commit comments

Comments
 (0)