Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set file status "uploading" earlier #5808

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ docs/public/previews

# flutter assets are built with `yarn flutter:build` and should not be checked in to source control
**/public/flutter/**/

.idea
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ export const setProcessedKeyAction = (input: {

export const setUploadingFileAction = ({
id,
uploadTask,
}: TaskEvent): Action => ({
type: FileUploaderActionTypes.SET_STATUS_UPLOADING,
id,
uploadTask,
});

export const setUploadProgressAction = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ export function useFileUploader(
};

const setUploadingFile: UseFileUploader['setUploadingFile'] = ({
uploadTask,
id,
}) => {
dispatch(setUploadingFileAction({ id, uploadTask }));
dispatch(setUploadingFileAction({ id }));
};

const setProcessedKey: UseFileUploader['setProcessedKey'] = (input) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function useUploadFiles({
useAccelerateEndpoint,
});

setUploadingFile({ id });
uploadFile({
input,
onComplete: (event) => {
Expand All @@ -99,11 +100,11 @@ export function useUploadFiles({
onUploadError(error.message, { key });
}
},
onStart: ({ key, uploadTask }) => {
onStart: ({ key }) => {
if (isFunction(onUploadStart)) {
onUploadStart({ key });
}
setUploadingFile({ id, uploadTask });
// setUploadingFile({ id, uploadTask });
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type PathCallback = (input: {
export type UploadTask = UploadDataOutput | UploadDataWithPathOutput;
export interface TaskEvent {
id: string;
uploadTask: UploadTask;
uploadTask?: UploadTask;
}

// omit `path` callback, `path` must always be a string to support resolving
Expand Down
Loading