Skip to content

Commit 70a7be8

Browse files
Fiz bug with upload window showing twice
1 parent d61c38a commit 70a7be8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/controls/listItemAttachments/UploadAttachment.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import styles from './ListItemAttachments.module.scss';
1212
export class UploadAttachment extends React.Component<IUploadAttachmentProps, IUploadAttachmentState> {
1313
private _spservice: SPservice;
1414
private fileInput;
15+
private _isFileExplorerOpen = false;
1516

1617
constructor(props: IUploadAttachmentProps) {
1718
super(props);
@@ -34,9 +35,10 @@ export class UploadAttachment extends React.Component<IUploadAttachmentProps, IU
3435
* @param prevState
3536
*/
3637
public componentDidUpdate(prevProps: IUploadAttachmentProps, prevState: IUploadAttachmentState): void {
37-
if (this.props.fireUpload && !this.state.isLoading) {
38+
if (this.props.fireUpload && !this._isFileExplorerOpen) {
3839
this.fileInput.current.value = '';
3940
this.fileInput.current.click();
41+
this._isFileExplorerOpen = true;
4042
}
4143
}
4244

@@ -80,6 +82,7 @@ export class UploadAttachment extends React.Component<IUploadAttachmentProps, IU
8082
});
8183
errorCallback(error);
8284
}
85+
this._isFileExplorerOpen = false;
8386
};
8487
reader.readAsDataURL(file);
8588
});

0 commit comments

Comments
 (0)