Skip to content

Commit

Permalink
Comment on places where we can use useTableSort in the future
Browse files Browse the repository at this point in the history
The logic copypasta'ed into these three tables is an older version of that which was just extracted into useTableSort. It's not possible to use hooks in a class component like these three, but we leave a note in these places reminding us to use useTableSort in case we convert them to functional components in the future.
  • Loading branch information
phildarnowsky-broad committed Feb 11, 2025
1 parent b6e48a3 commit 718c9c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions browser/src/CopyNumberVariantPage/CNVPopulationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,21 @@ type CNVPopulationsTableState = any
type CNVPopulationsTableProps = OwnPopulationsTableProps & typeof CNVPopulationsTable.defaultProps

export class CNVPopulationsTable extends Component<
CNVPopulationsTableProps & { variant: CopyNumberVariant},
CNVPopulationsTableProps & { variant: CopyNumberVariant },
CNVPopulationsTableState
> {
static defaultProps = {
columnLabels: {},
initiallyExpandRows: false,
variant: {}
variant: {},
}

constructor(props: CNVPopulationsTableProps ) {
constructor(props: CNVPopulationsTableProps) {
super(props)

// If/when we change this to a functional component, we can replace the
// following sorting logic and some other associated code by employing
// useTableSort.
this.state = {
sortBy: 'sf',
sortAscending: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class MitochondrialVariantHaplogroupFrequenciesTable extends Component<Props, St
sortAscending: false,
}

// If/when we change this to a functional component, we can replace the
// following sorting logic and some other associated code by employing
// useTableSort.
setSortBy(sortBy: any) {
this.setState((state: any) => ({
sortBy,
Expand Down
3 changes: 3 additions & 0 deletions browser/src/VariantPage/PopulationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export class PopulationsTable extends Component<PopulationsTableProps, Populatio
constructor(props: PopulationsTableProps) {
super(props)

// If/when we change this to a functional component, we can replace the
// following sorting logic and some other associated code by employing
// useTableSort.
this.state = {
sortBy: 'af',
sortAscending: false,
Expand Down

0 comments on commit 718c9c3

Please # to comment.