Skip to content

Commit edcea69

Browse files
bindoonyouluna
authored andcommitted
fix(Upload): Card progress under controled value. fix #2411
1 parent b865019 commit edcea69

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

scripts/upload-server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ http.createServer(function(req, res) {
3030

3131
form.parse(req, function(err, fields, files) {
3232
if (err) {
33-
res.send({ success: false, message: err });
33+
res.end({ success: false, message: err });
3434
return;
3535
}
3636

src/upload/card.jsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class Card extends Base {
7575
}
7676

7777
static getDerivedStateFromProps(nextProps, prevState) {
78-
if ('value' in nextProps && nextProps.value !== prevState.value) {
78+
const isUploading = prevState.uploaderRef && prevState.uploaderRef.isUploading();
79+
if ('value' in nextProps && nextProps.value !== prevState.value && !isUploading) {
7980
return {
8081
value: !Array.isArray(nextProps.value) ? [] : [].concat(nextProps.value),
8182
};
@@ -84,10 +85,12 @@ class Card extends Base {
8485
return null;
8586
}
8687

87-
onProgress = value => {
88+
onProgress = (value, targetItem) => {
8889
this.setState({
8990
value,
9091
});
92+
93+
this.props.onProgress(value, targetItem);
9194
};
9295

9396
onChange = (value, file) => {

0 commit comments

Comments
 (0)