Skip to content

fix(logs): Go back to prefetch query#114893

Merged
k-fish merged 9 commits into
masterfrom
fix/logs/prefetch-query-observers
May 28, 2026
Merged

fix(logs): Go back to prefetch query#114893
k-fish merged 9 commits into
masterfrom
fix/logs/prefetch-query-observers

Conversation

@k-fish
Copy link
Copy Markdown
Member

@k-fish k-fish commented May 5, 2026

As mentioned by tkdodo, we don't want to setup query observers when we don't need to, it's better to just have prefetches only when a hover happens.

Reverts the fetch change made in #98120

As mentioned by tkdodo, we don't want to setup query observers when we don't need to, it's better to just have prefetches only when a hover happens.
@k-fish k-fish requested a review from a team as a code owner May 5, 2026 18:38
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.59%

Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotta block this because of the wrong cache structure from requestPromise winding up in the cache might yield runtime errors in different places. happy to help with the apiOptions solution but agents are pretty good at this already as it’s documented in AGENTS.md

},
});
queryClient
.prefetchQuery({
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let’s use fetchQuery instead of prefetchQuery so that we get access to data directly in .then without having to call getQueryData again.

queryKey,
queryFn: () => {
const {url, options} = parseQueryKey(queryKey);
return QUERY_API_CLIENT.requestPromise(url, {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this from traceItemDetailsQueryKey (a function that produces a QueryKey) to apiOptions - a function that produces queryOptions.

queryOptions can be passed directly to queryClient.fetchQuery and to useQuery so it’s the better abstraction to share between those.

also, and that’s the important part: we don’t store results from requestPromise directly in the cache anymore, as it has a different structure. apiOptions uses apiFetch, which stores {json,headers}, a stucture that is much more convenient to work with. It’s also very important that all cache keys use the same structure. useApiQuery now also uses apiFetch so we should never call requestPromise directly anymore in a queryFn.

k-fish and others added 2 commits May 13, 2026 13:37
Replace useApiQuery/requestPromise with apiOptions/apiFetch to ensure
consistent {json,headers} cache structure. Switch prefetchQuery to
fetchQuery for direct data access without getQueryData.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread static/app/views/explore/hooks/useTraceItemDetails.tsx Outdated
Comment thread static/app/views/explore/hooks/useTraceItemDetails.tsx Outdated
Comment thread static/app/views/explore/hooks/useTraceItemDetails.tsx Outdated
…Query against missing project

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now 👍

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fb5c467. Configure here.

Comment thread static/app/views/explore/hooks/useTraceItemDetails.tsx
Comment thread static/app/views/explore/hooks/useTraceItemDetails.tsx
…sTableRow

Co-authored-by: Cursor <cursoragent@cursor.com>
@k-fish k-fish merged commit ed3c249 into master May 28, 2026
76 checks passed
@k-fish k-fish deleted the fix/logs/prefetch-query-observers branch May 28, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants