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> {
100100 const { props } = this ;
101101 if ( ! props . beforeUpload ) {
102102 // 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 ;
104107 }
105108
106109 const before = props . beforeUpload ( file , fileList ) ;
@@ -109,18 +112,20 @@ class AjaxUploader extends Component<UploadProps> {
109112 . then ( processedFile => {
110113 const processedFileType = Object . prototype . toString . call ( processedFile ) ;
111114 if ( processedFileType === '[object File]' || processedFileType === '[object Blob]' ) {
112- return this . post ( processedFile ) ;
115+ this . post ( processedFile ) ;
116+ return ;
113117 }
114- return this . post ( file ) ;
118+ this . post ( file ) ;
115119 } )
116120 . catch ( e => {
117121 // eslint-disable-next-line no-console
118122 console . log ( e ) ;
119123 } ) ;
120124 } else if ( before !== false ) {
121- setTimeout ( ( ) => this . post ( file ) , 0 ) ;
125+ Promise . resolve ( ) . then ( ( ) => {
126+ this . post ( file ) ;
127+ } ) ;
122128 }
123- return undefined ;
124129 }
125130
126131 post ( file : RcFile ) {
You can’t perform that action at this time.
0 commit comments