From 2ae4f873e9dc45a270c55116acac4adf8ffe03ba Mon Sep 17 00:00:00 2001 From: Drew Davis Date: Fri, 5 Dec 2025 09:47:44 -0500 Subject: [PATCH] fix: Disable useSessionId query when traceId input is undefined --- .changeset/modern-doors-own.md | 5 +++++ packages/app/src/components/DBRowSidePanel.tsx | 2 +- packages/app/src/components/DBSessionPanel.tsx | 8 ++++---- packages/app/src/components/DBTracePanel.tsx | 10 ++++------ 4 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 .changeset/modern-doors-own.md diff --git a/.changeset/modern-doors-own.md b/.changeset/modern-doors-own.md new file mode 100644 index 000000000..4e49d0e94 --- /dev/null +++ b/.changeset/modern-doors-own.md @@ -0,0 +1,5 @@ +--- +"@hyperdx/app": patch +--- + +fix: Disable useSessionId query when traceId input is undefined diff --git a/packages/app/src/components/DBRowSidePanel.tsx b/packages/app/src/components/DBRowSidePanel.tsx index 3f9fdaa5e..bda4170ef 100644 --- a/packages/app/src/components/DBRowSidePanel.tsx +++ b/packages/app/src/components/DBRowSidePanel.tsx @@ -234,7 +234,7 @@ const DBRowSidePanel = ({ }, [timestampDate]); const focusDate = timestampDate; - const traceId = normalizedRow?.['__hdx_trace_id']; + const traceId: string | undefined = normalizedRow?.['__hdx_trace_id']; const childSourceId = source.kind === 'log' diff --git a/packages/app/src/components/DBSessionPanel.tsx b/packages/app/src/components/DBSessionPanel.tsx index 073aa57fe..8f72cea05 100644 --- a/packages/app/src/components/DBSessionPanel.tsx +++ b/packages/app/src/components/DBSessionPanel.tsx @@ -14,7 +14,7 @@ export const useSessionId = ({ enabled = false, }: { sourceId?: string; - traceId: string; + traceId?: string; dateRange: [Date, Date]; enabled?: boolean; }) => { @@ -22,7 +22,7 @@ export const useSessionId = ({ const { data: source } = useSource({ id: sourceId }); const config = useMemo(() => { - if (!source) { + if (!source || !traceId) { return; } return { @@ -54,10 +54,10 @@ export const useSessionId = ({ }, [source, traceId]); const { data } = useEventsData({ - config: config!, // ok to force unwrap, the query will be disabled if source is null + config: config!, // ok to force unwrap, the query will be disabled if config is null dateRangeStartInclusive: true, dateRange, - enabled: enabled && !!source, + enabled: enabled && !!source && !!config, }); const result = useMemo(() => { diff --git a/packages/app/src/components/DBTracePanel.tsx b/packages/app/src/components/DBTracePanel.tsx index 674fad46e..56c695507 100644 --- a/packages/app/src/components/DBTracePanel.tsx +++ b/packages/app/src/components/DBTracePanel.tsx @@ -4,7 +4,6 @@ import { useForm } from 'react-hook-form'; import { tcFromSource } from '@hyperdx/common-utils/dist/core/metadata'; import { SourceKind } from '@hyperdx/common-utils/dist/types'; import { - Badge, Button, Center, Divider, @@ -19,7 +18,6 @@ import { DBTraceWaterfallChartContainer } from '@/components/DBTraceWaterfallCha import { useSource, useUpdateSource } from '@/source'; import TabBar from '@/TabBar'; -import ServiceMap from './ServiceMap/ServiceMap'; import { RowDataPanel } from './DBRowDataPanel'; import { RowOverviewPanel } from './DBRowOverviewPanel'; import { SourceSelectControlled } from './SourceSelect'; @@ -41,7 +39,7 @@ export default function DBTracePanel({ }: { parentSourceId?: string | null; childSourceId?: string | null; - traceId: string; + traceId?: string; dateRange: [Date, Date]; focusDate: Date; // Passed in from side panel to try to identify which @@ -54,7 +52,7 @@ export default function DBTracePanel({ }; 'data-testid'?: string; }) { - const { control, watch, setValue } = useForm({ + const { control, watch } = useForm({ defaultValues: { source: childSourceId, }, @@ -192,7 +190,7 @@ export default function DBTracePanel({ )} - {traceSourceData?.kind === SourceKind.Trace && ( + {traceSourceData?.kind === SourceKind.Trace && traceId && ( )} - {traceSourceData != null && !eventRowWhere && ( + {traceSourceData != null && !eventRowWhere && traceId && (
Please select a span above to view details.