From e09f69bd70791e7b508b0dc20faed96ba26f0392 Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Fri, 13 Mar 2020 17:26:17 +0100 Subject: [PATCH] do not try to load file if no file is available for widget --- src/widget/widgets/image.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widget/widgets/image.js b/src/widget/widgets/image.js index 2427084..3d24227 100644 --- a/src/widget/widgets/image.js +++ b/src/widget/widgets/image.js @@ -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 (