Deselect message history message when topic selection changes
Fixes #93
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as q from '../../../backend/src/Model'
|
||||
import { Dispatch } from 'redux'
|
||||
import { ActionTypes } from '../reducers/Sidebar'
|
||||
import { AppState } from '../reducers'
|
||||
import { Dispatch } from 'redux'
|
||||
import { makePublishEvent, rendererEvents } from '../../../events'
|
||||
|
||||
export const clearRetainedTopic = () => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
||||
@@ -12,6 +13,13 @@ export const clearRetainedTopic = () => (dispatch: Dispatch<any>, getState: () =
|
||||
dispatch(clearTopic(selectedTopic, false))
|
||||
}
|
||||
|
||||
export const setCompareMessage = (message?: q.Message) => (dispatch: Dispatch<any>) => {
|
||||
dispatch({
|
||||
message,
|
||||
type: ActionTypes.SIDEBAR_SET_COMPARE_MESSAGE,
|
||||
})
|
||||
}
|
||||
|
||||
export const clearTopic = (topic: q.TreeNode<any>, recursive: boolean, subtopicClearLimit = 50) => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
||||
const { connectionId } = getState().connection
|
||||
if (!connectionId) {
|
||||
@@ -25,7 +33,6 @@ export const clearTopic = (topic: q.TreeNode<any>, recursive: boolean, subtopicC
|
||||
retain: true,
|
||||
qos: 0 as 0,
|
||||
}
|
||||
console.log('deleting', topic.path())
|
||||
rendererEvents.emit(publishEvent, mqttMessage)
|
||||
|
||||
if (recursive) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as q from '../../../backend/src/Model'
|
||||
import { ActionTypes } from '../reducers/Tree'
|
||||
import { ActionTypes as SidebarActionTypes } from '../reducers/Sidebar'
|
||||
import { AnyAction, Dispatch } from 'redux'
|
||||
import { AppState } from '../reducers'
|
||||
import { batchActions } from 'redux-batched-actions'
|
||||
@@ -40,6 +41,11 @@ const debouncedSelectTopic = debounce((topic: q.TreeNode<TopicViewModel>, dispat
|
||||
type: ActionTypes.TREE_SELECT_TOPIC,
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: SidebarActionTypes.SIDEBAR_SET_COMPARE_MESSAGE,
|
||||
message: undefined,
|
||||
})
|
||||
|
||||
if (setTopicDispatch) {
|
||||
dispatch(batchActions([selectTreeTopicDispatch, setTopicDispatch]))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user