Fix memory leaks

This commit is contained in:
Thomas Nordquist
2019-04-24 23:40:28 +02:00
parent 4c4e1543ec
commit 749df70d5c
11 changed files with 58 additions and 33 deletions

View File

@@ -35,7 +35,6 @@ interface Props {
}
interface State {
node: q.TreeNode<TopicViewModel>
compareMessage?: q.Message
valueRenderWidth: number
}
@@ -49,8 +48,7 @@ class Sidebar extends React.Component<Props, State> {
constructor(props: any) {
super(props)
console.error('Find and fix me #state')
this.state = { node: new q.Tree(), valueRenderWidth: 300 }
this.state = { valueRenderWidth: 300 }
}
private registerUpdateListener(node: q.TreeNode<TopicViewModel>) {
@@ -156,7 +154,6 @@ class Sidebar extends React.Component<Props, State> {
public componentWillReceiveProps(nextProps: Props) {
this.props.node && this.removeUpdateListener(this.props.node)
nextProps.node && this.registerUpdateListener(nextProps.node)
this.props.node && this.setState({ node: this.props.node })
if (this.props.node !== nextProps.node) {
this.setState({ compareMessage: undefined })