1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00

do not try to load file if no file is available for widget

This commit is contained in:
Sonja Happ 2020-03-13 17:26:17 +01:00
parent 5c4afb686f
commit e09f69bd70

View file

@ -29,7 +29,7 @@ class WidgetImage extends React.Component {
componentDidMount() {
// Query the image referenced by the widget
let widgetFile = this.props.widget.customProperties.file;
if (widgetFile && !this.props.files.find(file => file.id === widgetFile)) {
if (widgetFile !== -1 && !this.props.files.find(file => file.id === widgetFile)) {
AppDispatcher.dispatch({
type: 'files/start-load',
data: widgetFile,
@ -39,7 +39,7 @@ class WidgetImage extends React.Component {
}
render() {
const file = this.props.files.find(file => file._id === this.props.widget.customProperties.file);
const file = this.props.files.find(file => file.id === this.props.widget.customProperties.file);
return (
<div className="full">