Fix publish topic update

This commit is contained in:
Thomas Nordquist
2019-01-20 12:47:46 +01:00
parent fa9def4dd7
commit 4d794205d5
2 changed files with 16 additions and 14 deletions

View File

@@ -74,9 +74,9 @@ class Publish extends React.Component<Props, State> {
}
this.props.actions.publish(this.props.connectionId)
const topic = this.currentTopic() || ''
const payload = this.props.payload
const topic = this.props.topic || ''
const payload = this.props.payload
if (this.props.connectionId && topic) {
this.addMessageToHistory(topic, payload)
}
@@ -100,19 +100,12 @@ class Publish extends React.Component<Props, State> {
)
}
private currentTopic(): string | undefined {
const { node, topic } = this.props
const selectedNodePath = (node ? node.path() : undefined)
return (topic !== undefined) ? topic : selectedNodePath
}
private clearTopic = () => {
this.props.actions.setTopic('')
}
private topic() {
const topicStr = this.currentTopic() || ''
const topicStr = this.props.topic || ''
return (
<div>