Don't set the data object unless we have data to set.

Fixes #121
This commit is contained in:
Travis Ralston 2017-10-10 22:32:08 -06:00
parent 3eddf325b5
commit 2d3c140b26
2 changed files with 3 additions and 2 deletions

View file

@ -106,8 +106,8 @@ export class WidgetComponent {
url: this.wrapUrl(this.newWidgetUrl),
type: this.primaryWidgetType,
name: this.newWidgetName || this.defaultName,
data: data,
};
if (data) constructedWidget.data = data;
this.isUpdating = true;
this.scalarApi.setWidget(this.roomId, constructedWidget)

View file

@ -52,7 +52,8 @@ export class YoutubeWidgetConfigComponent extends WidgetComponent implements Mod
return;
}
widget.data = {dimOriginalUrl: widget.newUrl};
if (!widget.data) widget.data = {};
widget.data.dimOriginalUrl = widget.newUrl;
widget.newUrl = url;
this.saveWidget(widget);
}