fix: fixed list panel getting no-data in full view and edit panel (#7320)

* fix: fixed list panel getting no-data in full view and edit panel

* fix: added cloneDeep for updatedQuery

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
SagarRajput-7 2025-03-19 11:58:20 +05:30 committed by GitHub
parent 7a225e0a4f
commit 4779300dea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 11 deletions

View File

@ -95,6 +95,7 @@ function FullView({
graphType: PANEL_TYPES.LIST,
selectedTime: widget?.timePreferance || 'GLOBAL_TIME',
globalSelectedInterval: globalSelectedTime,
variables: getDashboardVariables(selectedDashboard?.data.variables),
tableParams: {
pagination: {
offset: 0,

View File

@ -24,7 +24,7 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';
import useUrlQuery from 'hooks/useUrlQuery';
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { defaultTo, isEmpty, isUndefined } from 'lodash-es';
import { cloneDeep, defaultTo, isEmpty, isUndefined } from 'lodash-es';
import { Check, X } from 'lucide-react';
import { DashboardWidgetPageParams } from 'pages/DashboardWidget';
import { useAppContext } from 'providers/App/App';
@ -315,7 +315,25 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
// request data should be handled by the parent and the child components should consume the same
// this has been moved here from the left container
const [requestData, setRequestData] = useState<GetQueryResultsProps>(() => {
if (selectedWidget && selectedGraph !== PANEL_TYPES.LIST) {
const updatedQuery = cloneDeep(stagedQuery || initialQueriesMap.metrics);
updatedQuery.builder.queryData[0].pageSize = 10;
if (selectedWidget) {
if (selectedGraph === PANEL_TYPES.LIST) {
return {
query: updatedQuery,
graphType: PANEL_TYPES.LIST,
selectedTime: selectedTime.enum || 'GLOBAL_TIME',
globalSelectedInterval,
variables: getDashboardVariables(selectedDashboard?.data.variables),
tableParams: {
pagination: {
offset: 0,
limit: updatedQuery.builder.queryData[0].limit || 0,
},
},
};
}
return {
selectedTime: selectedWidget?.timePreferance,
graphType: getGraphType(selectedGraph || selectedWidget.panelTypes),
@ -327,8 +345,6 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
variables: getDashboardVariables(selectedDashboard?.data.variables),
};
}
const updatedQuery = { ...(stagedQuery || initialQueriesMap.metrics) };
updatedQuery.builder.queryData[0].pageSize = 10;
// If stagedQuery exists, don't re-run the query (e.g. when clicking on Add to Dashboard from logs and traces explorer)
if (!stagedQuery) {
@ -336,15 +352,10 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
}
return {
query: updatedQuery,
graphType: PANEL_TYPES.LIST,
graphType: selectedGraph,
selectedTime: selectedTime.enum || 'GLOBAL_TIME',
globalSelectedInterval,
tableParams: {
pagination: {
offset: 0,
limit: updatedQuery.builder.queryData[0].limit || 0,
},
},
variables: getDashboardVariables(selectedDashboard?.data.variables),
};
});