fix(logs): Go back to prefetch query#114893
Conversation
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.
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.59% |
TkDodo
left a comment
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
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, { |
There was a problem hiding this comment.
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.
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>
…Query against missing project Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…sTableRow Co-authored-by: Cursor <cursoragent@cursor.com>

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