Files
mqtt-explorer/app/src/components/Sidebar/NodeStats.tsx
Thomas Nordquist 2268175a38 Fix performance issue
When the root node was collapsed, it also was selected due to the click event.
The sidebar was updated every time a new message was receivend,
effectivly inhibiting the "render the tree if you got nothing else to do" optimization to render anything at all.

Fixes #7
2019-01-14 10:45:15 +01:00

29 lines
606 B
TypeScript

import * as React from 'react'
import * as q from '../../../../backend/src/Model'
import { Typography } from '@material-ui/core'
interface Props {
node: q.TreeNode
}
class NodeStats extends React.Component<Props, {}> {
constructor(props: any) {
super(props)
}
public render() {
const { node } = this.props
return (
<div>
<Typography>Messages: #{node.messages}</Typography>
<Typography>Subtopics: {node.leafCount()}</Typography>
<Typography>Messages Subtopics: #{node.leafMessageCount()}</Typography>
</div>
)
}
}
export default NodeStats