Skip to content

Commit

Permalink
Allow all parts of state to be undefined
Browse files Browse the repository at this point in the history
This prevents type errors when calling setState.
  • Loading branch information
victorlin committed Oct 30, 2024
1 parent 5595762 commit 701d856
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/components/tree/tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export interface TreeComponentPropsFromState {
}

export interface TreeComponentState {
hoveredNode: ReactTreeNode | null
tree: PhyloTree | null
treeToo: PhyloTree | null
hoveredNode?: ReactTreeNode
tree?: PhyloTree
treeToo?: PhyloTree
geneSortFn?: any
selectedNode?: Record<string, never> // I think this is ReactTreeNode but only set to empty.
}
Expand All @@ -116,11 +116,7 @@ export class TreeComponent extends React.Component<TreeComponentProps, TreeCompo
secondTree: null
};
this.tangleRef = undefined;
this.state = {
hoveredNode: null,
tree: null,
treeToo: null
};
this.state = {};

/* bind callbacks */
this.clearSelectedNode = callbacks.clearSelectedNode.bind(this);
Expand Down

0 comments on commit 701d856

Please sign in to comment.