Skip to content

[Detail Bug] Explore: pipeline hover-prefetch never warms detail-page cache due to mismatched fields string formatting #38348

Closed

Description

@detail-app

Detail Bug Report

https://app.detail.dev/org_3377c26d-da48-4ccd-b83a-22c542f4fe83/bugs/bug_752932d8-baf0-4f38-9597-9990f4409c15

Introduced in #28014 by @harshach on May 25, 2026

Summary

  • Context: Hovering/focusing an entity card in Explore prefetches the entity via React Query so the detail page that follows renders instantly from a warm cache slot (rest/queries/pipelineQuery.ts, wired in components/ExploreV1/ExploreSearchCard/ExploreSearchCard.tsx).
  • Bug: The prefetch writes its cache slot under a field string with no spaces after commas, while the pipeline detail page reads its slot using defaultFields from utils/PipelineDetailsUtils.tsx, which contains spaces — so the two React Query keys can never be equal and the prefetch slot is never consumed.
  • Actual vs. expected: Every hover/focus on a pipeline Explore card issues a full GET /api/v1/pipelines/name/{fqn}?fields=... whose response is never read, and navigating to the pipeline detail page always renders from the network with a cold cache; expected — the prefetch populates the exact slot the page queries, giving an instant paint.
  • Impact: The entire pipeline hover-prefetch feature is dead code: one full-entity API call per hover whose response is never consumed (the hover fetch itself matches the working Topic/Table design; only its result goes unused), and the "perceived-latency" optimization it was designed for (instant paint on click) never happens for pipelines.

Code with Bug

// rest/queries/pipelineQuery.ts — prefetch side (inlined list, bare commas)
const PIPELINE_DEFAULT_FIELDS = [
  TabSpecificField.FOLLOWERS,
  TabSpecificField.TASKS,
  // ...
].join(',');                                        // <-- BUG 🔴 bare commas, no spaces
const PREFETCH_PIPELINE_FIELDS = `${PIPELINE_DEFAULT_FIELDS},${TabSpecificField.USAGE_SUMMARY}`;
export const prefetchPipeline = (queryClient: QueryClient, fqn: string) =>
  prefetchPipelineByFqn(queryClient, fqn, PREFETCH_PIPELINE_FIELDS);
// utils/PipelineDetailsUtils.tsx — page side (defaultFields used by the page's query key)
export const defaultFields = `${TabSpecificField.FOLLOWERS}, ${TabSpecificField.TAGS}, ${TabSpecificField.OWNERS},${TabSpecificField.TASKS}, ${TabSpecificField.PIPELINE_STATUS}, ${TabSpecificField.DOMAINS},${TabSpecificField.DATA_PRODUCTS},${TabSpecificField.VOTES},${TabSpecificField.EXTENSION}`;
//                                                   ^-- BUG 🔴 stray spaces after some commas
// pages/PipelineDetails/PipelineDetailsPage.component.tsx — page reads the cache with this key
const pipelineFields = useMemo(() => {
  let fields = defaultFields;                                            // spaces preserved
  if (viewUsagePermission) {
    fields += `,${TabSpecificField.USAGE_SUMMARY}`;
  }
  return fields;
}, [viewUsagePermission]);
const pipelineCacheKey = useMemo(
  () => pipelineQueryKey(decodedPipelineFQN, pipelineFields),  // <-- BUG 🔴 never equal to prefetch key
  [decodedPipelineFQN, pipelineFields]
);

Explanation

React Query query keys are hashed by exact equality of key elements. Both prefetch and page use pipelineQueryKey(fqn, fields) (i.e., ['pipeline', fqn, fields]), but they build fields strings with different whitespace.

Backend tolerance for whitespace is irrelevant: both fields variants return identical payloads, but they populate different React Query cache slots, so the detail page never hits the prefetch-populated slot.

Codebase Inconsistency

  • rest/queries/pipelineQuery.ts explicitly states intent with a "Keep this list in sync with PipelineDetailsUtils.defaultFields" comment, but uses a whitespace-free joined list while utils/PipelineDetailsUtils.tsx includes spaces.
  • Siblings demonstrate the intended working pattern: Topic shares the exact same constant between prefetch and page; Table uses a space-free fields constant on both sides.

Recommended Fix

Normalize whitespace at the query-key boundary (or derive both from one shared source) so logically-equivalent field lists map to the same cache slot:

// rest/queries/pipelineQuery.ts
export const normalizeFields = (fields: string) => fields.replace(/\s+/g, '');
export const pipelineQueryKey = (fqn: string, fields: string) =>
  ['pipeline', fqn, normalizeFields(fields)] as const;   // now both sides agree (for a given permission state)

History

This bug was introduced in commit 38f32a6 (PR #28014, "Perceived-latency P1: ETag/304, deferred tab fetches, lazy widgets", 2026-05-25). The commit added prefetchPipeline with an inlined comma-joined field list (no spaces) that could not match the pre-existing space-containing PipelineDetailsUtils.defaultFields, so the prefetch slot has never been consumed.

Activity

  1. added a commit that references this issue on Nov 23, 2026
    9cfa30c
  2. added a commit that references this issue on Nov 23, 2026
    801d75b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions