Skip to content

Commit c680da9

Browse files
Mihir-MavalankarClaude Opus 4.6
andcommitted
fix(seer): Resolve TOP_N display type before LLM context capture
TOP_N widgets are mutated to AREA later in the render body, but useLLMContext read the pre-mutation value on first render, producing a misleading table query hint instead of the correct timeseries hint. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
1 parent 1bbe4ed commit c680da9

File tree

1 file changed

+10
-3
lines changed
  • static/app/views/dashboards/widgetCard

1 file changed

+10
-3
lines changed

static/app/views/dashboards/widgetCard/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,27 @@ function WidgetCard(props: Props) {
178178
const {dashboardId: currentDashboardId} = useParams<{dashboardId: string}>();
179179
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
180180

181+
// Resolve TOP_N → AREA before capturing context (the render body mutates
182+
// this later, but useLLMContext needs the resolved value on first render).
183+
const resolvedDisplayType =
184+
props.widget.displayType === DisplayType.TOP_N
185+
? DisplayType.AREA
186+
: props.widget.displayType;
187+
181188
// Push widget metadata into the LLM context tree for Seer Explorer.
182189
useLLMContext({
183190
title: props.widget.title,
184-
displayType: props.widget.displayType,
191+
displayType: resolvedDisplayType,
185192
widgetType: props.widget.widgetType,
186-
queryHint: getQueryHint(props.widget.displayType),
193+
queryHint: getQueryHint(resolvedDisplayType),
187194
queries: props.widget.queries.map(q => ({
188195
name: q.name,
189196
conditions: q.conditions,
190197
aggregates: q.aggregates,
191198
columns: q.columns,
192199
orderby: q.orderby,
193200
})),
194-
...getWidgetData(props.widget.displayType, data),
201+
...getWidgetData(resolvedDisplayType, data),
195202
});
196203

197204
const onDataFetched = (newData: Data) => {

0 commit comments

Comments
 (0)