Skip to content

Commit fe34d3f

Browse files
nsdeschenescodex
andcommitted
fix(explore): Avoid loading state for disabled attribute queries
Only report attribute loading while a query is actively fetching so disabled queries do not stay stuck in a pending spinner state. Add a regression test for the TanStack Query v5 disabled-query case. Co-Authored-By: GPT-5.4 <noreply@openai.com> Made-with: Cursor
1 parent 13bbc3f commit fe34d3f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

static/app/views/explore/hooks/useTraceItemAttributeKeys.spec.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,19 @@ describe('useTraceItemAttributeKeys', () => {
352352
expect(result.current.attributes).toEqual(defaultExpectedAttributes)
353353
);
354354
});
355+
356+
it('does not stay loading when the query is disabled', () => {
357+
const {result} = renderHookWithProviders(
358+
() =>
359+
useTraceItemAttributeKeys({
360+
enabled: false,
361+
traceItemType: TraceItemDataset.LOGS,
362+
type: 'string',
363+
}),
364+
{organization}
365+
);
366+
367+
expect(result.current.isLoading).toBe(false);
368+
expect(result.current.attributes).toBeUndefined();
369+
});
355370
});

static/app/views/explore/hooks/useTraceItemAttributeKeys.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function useTraceItemAttributeKeys({
6666
return {
6767
attributes: data,
6868
error,
69-
isLoading: isPending || (isFetching && normalizedSearch !== undefined),
69+
isLoading: isFetching && (isPending || normalizedSearch !== undefined),
7070
};
7171
}
7272

0 commit comments

Comments
 (0)