Merge pull request #817 from ente-io/fix-upload-cancel-upload
Fix upload cancel on collection-selector screen lead to bad state , and no new uploads were accepted
This commit is contained in:
commit
f12ad15d96
|
@ -14,6 +14,7 @@ export interface CollectionSelectorAttributes {
|
|||
showNextModal: () => void;
|
||||
title: string;
|
||||
fromCollection?: number;
|
||||
onCancel?: () => void;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
@ -61,7 +62,10 @@ function CollectionSelector({
|
|||
props.onClose();
|
||||
};
|
||||
|
||||
const onCloseButtonClick = () => props.onClose(true);
|
||||
const onCloseButtonClick = () => {
|
||||
attributes?.onCancel();
|
||||
props.onClose(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<AllCollectionDialog
|
||||
|
|
|
@ -118,6 +118,14 @@ export default function Uploader(props: Props) {
|
|||
|
||||
const uploadRunning = useRef(false);
|
||||
|
||||
const handleChoiceModalClose = () => {
|
||||
setChoiceModalView(false);
|
||||
uploadRunning.current = false;
|
||||
};
|
||||
const handleCollectionSelectorCancel = () => {
|
||||
uploadRunning.current = false;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
UploadManager.init(
|
||||
{
|
||||
|
@ -530,6 +538,7 @@ export default function Uploader(props: Props) {
|
|||
}
|
||||
props.setCollectionSelectorAttributes({
|
||||
callback: uploadFilesToExistingCollection,
|
||||
onCancel: handleCollectionSelectorCancel,
|
||||
showNextModal,
|
||||
title: constants.UPLOAD_TO_COLLECTION,
|
||||
});
|
||||
|
@ -583,7 +592,7 @@ export default function Uploader(props: Props) {
|
|||
<>
|
||||
<UploadStrategyChoiceModal
|
||||
open={choiceModalView}
|
||||
onClose={() => setChoiceModalView(false)}
|
||||
onClose={handleChoiceModalClose}
|
||||
uploadToSingleCollection={() =>
|
||||
uploadToSingleNewCollection(importSuggestion.rootFolderName)
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ class watchFolderService {
|
|||
file: EnteFile
|
||||
) {
|
||||
addLocalLog(() => `onFileUpload called`);
|
||||
if (!this.isUploadRunning) {
|
||||
if (!this.isUploadRunning()) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue