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
29 lines
606 B
TypeScript
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
|