File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
extensions/ql-vscode/src/view/compare-performance Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 11import type { ChangeEvent } from "react" ;
2- import { useMemo , useState , Fragment } from "react" ;
2+ import { Fragment , useMemo , useState } from "react" ;
33import type {
44 SetPerformanceComparisonQueries ,
55 ToComparePerformanceViewMessage ,
@@ -354,6 +354,14 @@ function withToggledValue<T>(set: Set<T>, value: T) {
354354 return result ;
355355}
356356
357+ function union < T > ( a : Set < T > | T [ ] , b : Set < T > | T [ ] ) {
358+ const result = new Set ( a ) ;
359+ for ( const x of b ) {
360+ result . add ( x ) ;
361+ }
362+ return result ;
363+ }
364+
357365export function ComparePerformance ( _ : Record < string , never > ) {
358366 const [ data , setData ] = useState <
359367 SetPerformanceComparisonQueries | undefined
@@ -398,10 +406,10 @@ function ComparePerformanceWithData(props: {
398406
399407 const [ metric , setMetric ] = useState < Metric > ( metrics . tuples ) ;
400408
401- const nameSet = new Set ( from . data . names ) ;
402- for ( const name of to . data . names ) {
403- nameSet . add ( name ) ;
404- }
409+ const nameSet = useMemo (
410+ ( ) => union ( from . data . names , to . data . names ) ,
411+ [ from , to ] ,
412+ ) ;
405413
406414 let hasCacheHitMismatch = false ;
407415
You can’t perform that action at this time.
0 commit comments