Skip to content

Commit fde40b2

Browse files
committed
fix: set file status "uploading" earlier
1 parent 8f43ce3 commit fde40b2

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ docs/public/previews
2525

2626
# flutter assets are built with `yarn flutter:build` and should not be checked in to source control
2727
**/public/flutter/**/
28+
29+
.idea

packages/react-storage/src/components/FileUploader/hooks/useFileUploader/actions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ export const setProcessedKeyAction = (input: {
3232

3333
export const setUploadingFileAction = ({
3434
id,
35-
uploadTask,
3635
}: TaskEvent): Action => ({
3736
type: FileUploaderActionTypes.SET_STATUS_UPLOADING,
3837
id,
39-
uploadTask,
4038
});
4139

4240
export const setUploadProgressAction = ({

packages/react-storage/src/components/FileUploader/hooks/useFileUploader/useFileUploader.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ export function useFileUploader(
7171
};
7272

7373
const setUploadingFile: UseFileUploader['setUploadingFile'] = ({
74-
uploadTask,
7574
id,
7675
}) => {
77-
dispatch(setUploadingFileAction({ id, uploadTask }));
76+
dispatch(setUploadingFileAction({ id }));
7877
};
7978

8079
const setProcessedKey: UseFileUploader['setProcessedKey'] = (input) => {

packages/react-storage/src/components/FileUploader/hooks/useUploadFiles/useUploadFiles.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function useUploadFiles({
8282
useAccelerateEndpoint,
8383
});
8484

85+
setUploadingFile({ id });
8586
uploadFile({
8687
input,
8788
onComplete: (event) => {
@@ -99,11 +100,11 @@ export function useUploadFiles({
99100
onUploadError(error.message, { key });
100101
}
101102
},
102-
onStart: ({ key, uploadTask }) => {
103+
onStart: ({ key }) => {
103104
if (isFunction(onUploadStart)) {
104105
onUploadStart({ key });
105106
}
106-
setUploadingFile({ id, uploadTask });
107+
// setUploadingFile({ id, uploadTask });
107108
},
108109
});
109110
}

packages/react-storage/src/components/FileUploader/utils/uploadFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type PathCallback = (input: {
2020
export type UploadTask = UploadDataOutput | UploadDataWithPathOutput;
2121
export interface TaskEvent {
2222
id: string;
23-
uploadTask: UploadTask;
23+
uploadTask?: UploadTask;
2424
}
2525

2626
// omit `path` callback, `path` must always be a string to support resolving

0 commit comments

Comments
 (0)