From 5425a80ada1736fa2f7a53758bc0165635e4cc38 Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Fri, 11 Jan 2019 10:32:29 +0100 Subject: [PATCH] Fix topic selection --- app/src/components/Sidebar/Publisher.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/components/Sidebar/Publisher.tsx b/app/src/components/Sidebar/Publisher.tsx index 88555d3..0d27b7c 100644 --- a/app/src/components/Sidebar/Publisher.tsx +++ b/app/src/components/Sidebar/Publisher.tsx @@ -54,7 +54,7 @@ class Publisher extends React.Component { private publish = (e: React.MouseEvent) => { e.stopPropagation() - const topic = this.state.customTopic + const topic = this.currentTopic() || '' const payload = this.state.payload if (this.props.connectionId && topic) { @@ -81,9 +81,13 @@ class Publisher extends React.Component { ) } - private topic() { + private currentTopic(): string | undefined { const { node } = this.props - const topicStr = (this.state.customTopic !== undefined) ? this.state.customTopic : (node ? node.path() : '') + return (this.state.customTopic !== undefined) ? this.state.customTopic : (node ? node.path() : undefined) + } + + private topic() { + const topicStr = this.currentTopic() || '' return (