Skip to content

Commit

Permalink
fix: prevent unnecessary query re-runs by checking stagedQuery before…
Browse files Browse the repository at this point in the history
… redirecting in NewWidget
  • Loading branch information
ahmadshaheer committed Dec 30, 2024
1 parent bab2667 commit 10cf077
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/container/NewWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
}
const updatedQuery = { ...(stagedQuery || initialQueriesMap.metrics) };
updatedQuery.builder.queryData[0].pageSize = 10;
redirectWithQueryBuilderData(updatedQuery);

// If stagedQuery exists, don't re-run the query (e.g. when clicking on Add to Dashboard from logs and traces explorer)
if (!stagedQuery) {
redirectWithQueryBuilderData(updatedQuery);
}
return {
query: updatedQuery,
graphType: PANEL_TYPES.LIST,
Expand Down

0 comments on commit 10cf077

Please sign in to comment.