File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,10 @@ class AjaxUploader extends Component<UploadProps> {
100
100
const { props } = this ;
101
101
if ( ! props . beforeUpload ) {
102
102
// always async in case use react state to keep fileList
103
- return setTimeout ( ( ) => this . post ( file ) , 0 ) ;
103
+ Promise . resolve ( ) . then ( ( ) => {
104
+ this . post ( file ) ;
105
+ } ) ;
106
+ return ;
104
107
}
105
108
106
109
const before = props . beforeUpload ( file , fileList ) ;
@@ -109,18 +112,20 @@ class AjaxUploader extends Component<UploadProps> {
109
112
. then ( processedFile => {
110
113
const processedFileType = Object . prototype . toString . call ( processedFile ) ;
111
114
if ( processedFileType === '[object File]' || processedFileType === '[object Blob]' ) {
112
- return this . post ( processedFile ) ;
115
+ this . post ( processedFile ) ;
116
+ return ;
113
117
}
114
- return this . post ( file ) ;
118
+ this . post ( file ) ;
115
119
} )
116
120
. catch ( e => {
117
121
// eslint-disable-next-line no-console
118
122
console . log ( e ) ;
119
123
} ) ;
120
124
} else if ( before !== false ) {
121
- setTimeout ( ( ) => this . post ( file ) , 0 ) ;
125
+ Promise . resolve ( ) . then ( ( ) => {
126
+ this . post ( file ) ;
127
+ } ) ;
122
128
}
123
- return undefined ;
124
129
}
125
130
126
131
post ( file : RcFile ) {
You can’t perform that action at this time.
0 commit comments