diff --git a/.changeset/delta-mode-log-source-fallback.md b/.changeset/delta-mode-log-source-fallback.md new file mode 100644 index 000000000..c22573421 --- /dev/null +++ b/.changeset/delta-mode-log-source-fallback.md @@ -0,0 +1,7 @@ +--- +'@hyperdx/app': patch +--- + +Fix blank search panel when switching from a trace source in Event Deltas mode +to a source that doesn't support deltas (e.g. a log source). The view now falls +back to the results table and shows a notification. diff --git a/packages/app/src/DBSearchPage.tsx b/packages/app/src/DBSearchPage.tsx index 0d883d460..564ff5c5e 100644 --- a/packages/app/src/DBSearchPage.tsx +++ b/packages/app/src/DBSearchPage.tsx @@ -1146,6 +1146,36 @@ function DBSearchPageContent() { } }, [analysisMode, setIsLive]); + // Event deltas only apply to trace sources that expose a duration. Mirrors + // the "Event Deltas" tab visibility so the two never disagree. + const searchedSourceSupportsDelta = + searchedSource?.kind === SourceKind.Trace && + !!searchedSource.durationExpression; + + // Switching to a source that can't do deltas (e.g. a log source) while in + // delta mode would otherwise leave an empty panel. Fall back to the results + // table and tell the user why. + useEffect(() => { + if ( + analysisMode === 'delta' && + searchedSource != null && + !searchedSourceSupportsDelta + ) { + setAnalysisMode('results'); + notifications.show({ + id: 'delta-mode-unsupported-source', + color: 'yellow', + message: + 'Event deltas are only available for trace sources. Switched to the results table.', + }); + } + }, [ + analysisMode, + searchedSource, + searchedSourceSupportsDelta, + setAnalysisMode, + ]); + const [isFilterSidebarCollapsed, setIsFilterSidebarCollapsed] = useLocalStorage('isFilterSidebarCollapsed', false); // Compact open state stays out of `isFilterSidebarCollapsed`. Writing that @@ -2750,11 +2780,7 @@ function DBSearchPageContent() { setAnalysisMode={setAnalysisMode} chartConfig={filtersChartConfig} sourceId={inputSourceObj?.id} - showDelta={ - !!(searchedSource?.kind === SourceKind.Trace - ? searchedSource.durationExpression - : undefined) - } + showDelta={searchedSourceSupportsDelta} onColumnToggle={toggleColumn} displayedColumns={displayedColumns} onCollapse={isCompact ? undefined : collapseFilters}