11'use client' ;
22import { track } from '@/lib/analytics' ;
33import Link from 'next/link' ;
4- import { useEffect , useMemo , useRef , useState } from 'react' ;
4+ import { useMemo , useState } from 'react' ;
55import { ChevronDown , X } from 'lucide-react' ;
66
77import { useInference } from '@/components/inference/InferenceContext' ;
@@ -37,7 +37,6 @@ import {
3737 Sequence ,
3838} from '@/lib/data-mappings' ;
3939import { useComparisonChangelogs } from '@/hooks/api/use-comparison-changelogs' ;
40- import { configKeyMatchesHwKey } from '@/components/inference/utils/changelogFormatters' ;
4140import { useTrendData } from '@/components/inference/hooks/useTrendData' ;
4241
4342import ChartControls from './ChartControls' ;
@@ -113,8 +112,6 @@ export default function ChartDisplay() {
113112 selectedGPUs,
114113 selectedPrecisions,
115114 selectedDateRange,
116- setSelectedDates,
117- availableDates,
118115 dateRangeAvailableDates,
119116 selectedModel,
120117 selectedSequence,
@@ -130,49 +127,15 @@ export default function ChartDisplay() {
130127
131128 const {
132129 changelogs,
130+ intermediateDates,
133131 loading : changelogsLoading ,
134132 totalDatesQueried,
135- } = useComparisonChangelogs ( selectedGPUs , selectedDateRange , availableDates ) ;
136-
137- // Auto-populate intermediate dates from changelog dates so they appear on the GPU graph
138- const prevChangelogDatesRef = useRef ( '' ) ;
139- useEffect ( ( ) => {
140- if ( ! selectedDateRange . startDate || ! selectedDateRange . endDate || selectedGPUs . length === 0 )
141- return ;
142- const gpuDatesSet = new Set ( dateRangeAvailableDates ) ;
143- const precSet = new Set ( selectedPrecisions ) ;
144- const changelogDates = changelogs
145- . filter ( ( c ) =>
146- c . entries . some ( ( entry ) =>
147- entry . config_keys . some ( ( key ) => {
148- const precision = key . split ( '-' ) [ 1 ] ;
149- return (
150- precSet . has ( precision ) && selectedGPUs . some ( ( gpu ) => configKeyMatchesHwKey ( key , gpu ) )
151- ) ;
152- } ) ,
153- ) ,
154- )
155- . map ( ( c ) => c . date )
156- . filter (
157- ( d ) =>
158- d !== selectedDateRange . startDate &&
159- d !== selectedDateRange . endDate &&
160- gpuDatesSet . has ( d ) ,
161- )
162- . sort ( ) ;
163- const key = changelogDates . join ( ',' ) ;
164- if ( key !== prevChangelogDatesRef . current ) {
165- prevChangelogDatesRef . current = key ;
166- setSelectedDates ( changelogDates ) ;
167- }
168- } , [
169- changelogs ,
170- selectedDateRange ,
133+ } = useComparisonChangelogs (
171134 selectedGPUs ,
172135 selectedPrecisions ,
173- setSelectedDates ,
136+ selectedDateRange ,
174137 dateRangeAvailableDates ,
175- ] ) ;
138+ ) ;
176139
177140 const { unofficialRunInfo, getOverlayData, isUnofficialRun } = useUnofficialRun ( ) ;
178141
@@ -705,7 +668,7 @@ export default function ChartDisplay() {
705668 < SocialShareButtons compact className = "hidden sm:flex" />
706669 </ div >
707670 </ div >
708- < ChartControls />
671+ < ChartControls intermediateDates = { intermediateDates } />
709672 < ModelArchitectureDiagram model = { selectedModel } />
710673 { selectedGPUs . length === 0 && < WorkflowInfoDisplay workflowInfo = { workflowInfo } /> }
711674 { selectedGPUs . length > 0 &&
@@ -715,7 +678,6 @@ export default function ChartDisplay() {
715678 changelogs = { changelogs }
716679 selectedGPUs = { selectedGPUs }
717680 selectedPrecisions = { selectedPrecisions }
718- selectedDateRange = { selectedDateRange }
719681 loading = { changelogsLoading }
720682 totalDatesQueried = { totalDatesQueried }
721683 />
0 commit comments