mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
fix(client/import): file remains from previous instance (closes #7428)
This commit is contained in:
@@ -51,7 +51,10 @@ export default function ImportDialog() {
|
||||
setShown(false);
|
||||
await importService.uploadFiles("notes", parentNoteId, Array.from(files), options);
|
||||
}}
|
||||
onHidden={() => setShown(false)}
|
||||
onHidden={() => {
|
||||
setShown(false);
|
||||
setFiles(null);
|
||||
}}
|
||||
footer={<Button text={t("import.import")} primary disabled={!files} />}
|
||||
show={shown}
|
||||
>
|
||||
|
||||
@@ -47,7 +47,10 @@ export default function UploadAttachmentsDialog() {
|
||||
setIsUploading(false);
|
||||
setShown(false);
|
||||
}}
|
||||
onHidden={() => setShown(false)}
|
||||
onHidden={() => {
|
||||
setShown(false);
|
||||
setFiles(null);
|
||||
}}
|
||||
show={shown}
|
||||
>
|
||||
<FormGroup name="files" label={t("upload_attachments.choose_files")} description={description}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Ref } from "preact";
|
||||
import Button, { ButtonProps } from "./Button";
|
||||
import { useRef } from "preact/hooks";
|
||||
import { useEffect, useRef } from "preact/hooks";
|
||||
|
||||
interface FormFileUploadProps {
|
||||
name?: string;
|
||||
@@ -11,6 +11,11 @@ interface FormFileUploadProps {
|
||||
}
|
||||
|
||||
export default function FormFileUpload({ inputRef, name, onChange, multiple, hidden }: FormFileUploadProps) {
|
||||
// Prevent accidental reuse of a file selected in a previous instance of the upload form.
|
||||
useEffect(() => {
|
||||
onChange(null);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<label class="tn-file-input tn-input-field" style={hidden ? { display: "none" } : undefined}>
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user