forked from external-repos/squoosh
fix select the same file bug (#538)
This commit is contained in:
@@ -53,11 +53,17 @@ export default class Intro extends Component<Props, State> {
|
|||||||
state: State = {};
|
state: State = {};
|
||||||
private fileInput?: HTMLInputElement;
|
private fileInput?: HTMLInputElement;
|
||||||
|
|
||||||
|
@bind
|
||||||
|
private resetFileInput() {
|
||||||
|
this.fileInput!.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
private onFileChange(event: Event): void {
|
private onFileChange(event: Event): void {
|
||||||
const fileInput = event.target as HTMLInputElement;
|
const fileInput = event.target as HTMLInputElement;
|
||||||
const file = fileInput.files && fileInput.files[0];
|
const file = fileInput.files && fileInput.files[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
this.resetFileInput();
|
||||||
this.props.onFile(file);
|
this.props.onFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user