bugfix (#5): display bug while uploading a file

This commit is contained in:
Mickael KERJEAN 2017-07-01 10:54:51 +10:00
parent 089620a6e3
commit 870d4e7ba5
3 changed files with 9 additions and 10 deletions

View file

@ -122,12 +122,17 @@ export class FilesPage extends React.Component {
const updateUI = (filename) => {
const files = JSON.parse(JSON.stringify(this.state.files))
.map((file) => {
// persist file in UI
if(file.name === filename){
file.virtual = false;
delete file.icon;
}
return file;
});
// remove from ui if we upload the file in a different directory
return path === this.state.path ? file : null;
})
.filter((file) => {
return file === null? false : true;
})
this.setState({files: files});
return Promise.resolve('ok')
}

View file

@ -142,7 +142,7 @@ export class ExistingThing extends React.Component {
}).catch((err) => {
if(err && err.code === 'CANCELLED'){ return }
this.setState({icon: 'error', message: err.message});
})
});
}
}

View file

@ -9,13 +9,7 @@ import { theme, to_rgba } from '../../utilities';
@DropTarget('__NATIVE_FILE__', {
drop(props, monitor){
let files = monitor.getItem().files
props.emit('file.upload', props.path, files)
.then((ok) => {
console.log("DONE", ok)
})
.catch((err) => {
console.log("ERROR", err)
})
props.emit('file.upload', props.path, files);
}
}, (connect, monitor) => ({
connectDropFile: connect.dropTarget(),