11import type { ChangeEvent } from "react" ;
2- import { Fragment , useMemo , useRef , useState } from "react" ;
2+ import { Fragment , memo , useMemo , useRef , useState } from "react" ;
33import type {
44 SetPerformanceComparisonQueries ,
55 ToComparePerformanceViewMessage ,
@@ -577,15 +577,12 @@ function ComparePerformanceWithData(props: {
577577 </ HeaderTR >
578578 </ thead >
579579 </ Table >
580- { rowGroups . map ( ( rowGroup , rowGroupIndex ) => (
581- < PredicateRowGroup
582- key = { rowGroupIndex }
583- renderedName = { rowGroupNames [ rowGroupIndex ] }
584- rowGroup = { rowGroup }
585- comparison = { comparison }
586- metric = { metric }
587- />
588- ) ) }
580+ < PredicateTable
581+ rowGroups = { rowGroups }
582+ rowGroupNames = { rowGroupNames }
583+ comparison = { comparison }
584+ metric = { metric }
585+ />
589586 < Table >
590587 < tfoot >
591588 < tr key = "spacing" >
@@ -606,6 +603,28 @@ function ComparePerformanceWithData(props: {
606603 ) ;
607604}
608605
606+ interface PredicateTableProps {
607+ rowGroups : RowGroup [ ] ;
608+ rowGroupNames : React . ReactNode [ ] ;
609+ comparison : boolean ;
610+ metric : Metric ;
611+ }
612+
613+ function PredicateTableRaw ( props : PredicateTableProps ) {
614+ const { comparison, metric, rowGroupNames, rowGroups } = props ;
615+ return rowGroups . map ( ( rowGroup , rowGroupIndex ) => (
616+ < PredicateRowGroup
617+ key = { rowGroupIndex }
618+ renderedName = { rowGroupNames [ rowGroupIndex ] }
619+ rowGroup = { rowGroup }
620+ comparison = { comparison }
621+ metric = { metric }
622+ />
623+ ) ) ;
624+ }
625+
626+ const PredicateTable = memo ( PredicateTableRaw ) ;
627+
609628interface PredicateRowGroupProps {
610629 renderedName : React . ReactNode ;
611630 rowGroup : RowGroup ;
0 commit comments