mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
fix for image widget: first selected image is displayed immediately
This commit is contained in:
parent
e396d722a1
commit
882febc12c
1 changed files with 9 additions and 13 deletions
|
@ -45,20 +45,16 @@ class WidgetImage extends React.Component {
|
|||
|
||||
let file = this.props.files.find(file => file.id === parseInt(this.props.widget.customProperties.file, 10));
|
||||
|
||||
if(file !== undefined){
|
||||
if(this.state.file === undefined || (this.state.file.id !== file.id )){
|
||||
if (file !== undefined) {
|
||||
if (this.state.file === undefined || (this.state.file.id !== file.id)) {
|
||||
|
||||
// if file has changed, download new file
|
||||
if (this.state.file !== undefined && this.state.file.id !== file.id){
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-download',
|
||||
data: file.id,
|
||||
token: this.props.token
|
||||
});
|
||||
}
|
||||
|
||||
// either first time update or file id has changed
|
||||
this.setState({file:file})
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-download',
|
||||
data: file.id,
|
||||
token: this.props.token
|
||||
});
|
||||
|
||||
this.setState({ file: file })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue