fix: added fix for order by in trace opeartor

This commit is contained in:
ahrefabhi
2025-09-04 18:23:14 +05:30
parent 56b153adc2
commit 0896ed9da9
2 changed files with 26 additions and 2 deletions

View File

@@ -106,6 +106,16 @@ function ListView({
];
}
// add order by to trace operator
if (query.builder.queryTraceOperator.length > 0) {
query.builder.queryTraceOperator[0].orderBy = [
{
columnName: orderBy.split(':')[0],
order: orderBy.split(':')[1] as 'asc' | 'desc',
},
];
}
return query;
}, [stagedQuery, orderBy]);

View File

@@ -102,7 +102,15 @@ function TracesExplorer(): JSX.Element {
handleSetConfig(PANEL_TYPES.LIST, DataSource.TRACES);
}
// TODO: remove formula when switching to List view
if (
(selectedView === ExplorerViews.TRACE ||
selectedView === ExplorerViews.LIST) &&
stagedQuery?.builder?.queryTraceOperator &&
stagedQuery.builder.queryTraceOperator.length > 0
) {
// remove order by from trace operator
stagedQuery.builder.queryTraceOperator[0].orderBy = [];
}
setSelectedView(view);
@@ -110,7 +118,13 @@ function TracesExplorer(): JSX.Element {
view === ExplorerViews.TIMESERIES ? PANEL_TYPES.TIME_SERIES : view,
);
},
[handleSetConfig, handleExplorerTabChange, selectedView, setSelectedView],
[
handleSetConfig,
handleExplorerTabChange,
selectedView,
setSelectedView,
stagedQuery,
],
);
const listQuery = useMemo(() => {