File tree Expand file tree Collapse file tree
components/src/ParcaContext Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export interface AdditionalMetricsGraphProps {
5555interface ExternalProfilerComponentProps {
5656 disableProfileTypesDropdown ?: boolean ;
5757 defaultProfileType ?: string ;
58+ defaultSumBy ?: string [ ] ;
5859 configuredLabelNames ?: string [ ] ;
5960 disableExplorativeQuerying ?: boolean ;
6061 profileFilterDefaults ?: unknown [ ] ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ interface UseQueryStateReturn {
7979}
8080
8181export const useQueryState = ( options : UseQueryStateOptions = { } ) : UseQueryStateReturn => {
82- const { queryServiceClient : queryClient } = useParcaContext ( ) ;
82+ const { queryServiceClient : queryClient , externalProfilerComponent } = useParcaContext ( ) ;
8383 const {
8484 suffix = '' ,
8585 defaultExpression = '' ,
@@ -153,6 +153,13 @@ export const useQueryState = (options: UseQueryStateOptions = {}): UseQueryState
153153 // Parse sumBy from URL parameter format
154154 const sumBy = useSumByFromParams ( sumByParam ?? undefined ) ;
155155
156+ // Fall back to the externally-provided sumBy default when the URL carries no
157+ // sum_by, so the materialized value reflects it instead of the empty __none__
158+ // sentinel (an explicit __none__ from the URL is left untouched).
159+ const externalSumBy = externalProfilerComponent ?. defaultSumBy ;
160+ const sumByWithViewDefault =
161+ sumBy ?? ( externalSumBy != null && externalSumBy . length > 0 ? externalSumBy : undefined ) ;
162+
156163 // Draft state management
157164 const [ draftExpression , setDraftExpression ] = useState < string > ( expression ?? defaultExpression ) ;
158165 const [ draftFrom , setDraftFrom ] = useState < string > ( from ?? defaultFrom ?. toString ( ) ?? '' ) ;
@@ -209,7 +216,7 @@ export const useQueryState = (options: UseQueryStateOptions = {}): UseQueryState
209216 draftTimeRange ,
210217 draftProfileType ,
211218 draftTimeRange ,
212- sumBy
219+ sumByWithViewDefault
213220 ) ;
214221
215222 // Sync draft state with URL state when URL changes externally
You can’t perform that action at this time.
0 commit comments