From 60059b71af28f2b6d67ccef408dadc0ef76a30e8 Mon Sep 17 00:00:00 2001 From: Dorian Goepp <dorian.goepp@gmail.com> Date: Mon, 19 Aug 2019 16:07:47 +0200 Subject: [PATCH] fix a tiny bug in Video Stream --- src/VideoStream/index.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/VideoStream/index.js b/src/VideoStream/index.js index 9ec20f9..bc95c05 100644 --- a/src/VideoStream/index.js +++ b/src/VideoStream/index.js @@ -42,13 +42,13 @@ class VideoStream extends Component { this.store = new VideoStore(); - // Automatically detect if the configured topic name is valid - this.hasTopic = observable.box(false); - this.searchForTopic() - // Fill the undefined fields of the configuration object with their default values. defaultConfig(this.store); this.props.store.components['video'] = this.store; + + // Automatically detect if the configured topic name is valid + this.hasTopic = observable.box(false); + this.searchForTopic(); } defaultImage = 'images/default.svg'; @@ -62,7 +62,7 @@ class VideoStream extends Component { get streamUrl() { if ('url' in this.props && this.props.url) { return this.props.url; - } else if (this.hasTopic.get()) { + } else if (this.hasTopic.get()) { // all requierd configuration fields are defined return 'http://' + this.store.config.host + '/stream?topic=' + this.store.config.topic; @@ -74,7 +74,7 @@ class VideoStream extends Component { /** * Check that all the requirements are met for subscribing to the required * topic - * + * * Thanks to MobX magic, the result is computed again each time the topic * configuration is changed. */ @@ -88,19 +88,18 @@ class VideoStream extends Component { this.props.ros.getTopics(infos => { this.hasTopic.set(undefined !== infos.topics.find( elem => elem === this.store.config.topic)); - + if (!this.hasTopic.get()) { console.warn("[VideoStream] The required topic " + this.store.config.topic + " is not published"); } - console.debug(this.hasTopic.get()); }) } else { console.warn("[VideoStream] either no topic is configured " + "or no host is configured. This should never " + "happen at runtime. Contact the developpers."); } - }) + }, {fireImmediately: true}) } else { console.warn("[VideoStream] ROS property is provided. This should " + "never happen at runtime. Contact the developpers."); -- GitLab