Skip to content

[Detail Bug] UI: Data Quality badge shows previous table's alerts briefly after navigating between tables #39134

Backlog

Description

@detail-app

Detail Bug Report

https://app.detail.dev/org_3377c26d-da48-4ccd-b83a-22c542f4fe83/bugs/bug_77f9c382-af7d-4db5-a344-ac2b6b6543e9

Introduced in #34555 by @shah-harshit on Oct 5, 2026

Summary

  • Context: TableDetailsPageV1 renders a Data Quality indicator badge (failing tests / open incidents / upstream issues) in the entity header via DataQualityIndicator, driven by dqIndicatorCounts state on the page component.
  • Bug: When navigating from one table to another (/table/A → /table/B), the page component instance persists (no remount key in the routing chain) and dqIndicatorCounts is never reset on entity change, so table B's header displays table A's DQ badge until table B's three DQ API calls resolve.
  • Actual vs. expected: The new table's header paints with the previous table's red/amber indicator, wrong data-level, wrong tooltip counts, and an aria-label/action claiming failing tests or open incidents on a table that has none; expected behaviour is that the counts reset to EMPTY_DQ_INDICATOR_COUNTS when the table FQN changes.
  • Impact: A table with a clean data-quality record is shown with a red "failing tests" alert badge and a click-through action pointing at its own profiler Data Quality tab — actively wrong data-quality information presented to the user during every table-to-table navigation, lasting as long as the DQ API round-trip (hundreds of ms to seconds).

Code with Bug

openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.tsx

const [dqIndicatorCounts, setDqIndicatorCounts] =
  useState<DataQualityIndicatorCounts>(EMPTY_DQ_INDICATOR_COUNTS);
badge={
  <DataQualityIndicator
    counts={dqIndicatorCounts}
    tableFqn={tableFqn}
  />
}
useEffect(() => {
  if (!loadedTableFqn) {
    return;
  }
  let isCurrent = true;
  void fetchDqIndicatorCounts(() => isCurrent);

  return () => {
    isCurrent = false;
  };
}, [loadedTableFqn, fetchDqIndicatorCounts]);
const fetchDqIndicatorCounts = useCallback(
  async (isCurrent: () => boolean) => {
    if (!tableClassBase.getAlertEnableStatus()) {
      setDqIndicatorCounts(EMPTY_DQ_INDICATOR_COUNTS); // <-- BUG 🔴 only reset path; does not run when alerts are enabled

      return;
    }
    // ...three concurrent API calls via Promise.allSettled; setDqIndicatorCounts({...}) happens only after they resolve

Explanation

  • dqIndicatorCounts is stored as local state on TableDetailsPageV1, and the router does not remount the page component when navigating between tables of the same entity type.
  • When loadedTableFqn changes, the effect triggers a refetch but does not synchronously reset dqIndicatorCounts.
  • In the alerts-enabled path (getAlertEnableStatus() === true), the state remains whatever it was for the previous table until the three network calls settle and update it, so the header badge renders stale counts for the newly navigated table.
  • DataQualityIndicator is a pure renderer and will display any stale counts it receives.

Codebase Inconsistency

The same stale-window issue was previously addressed for the sibling Queries badge (resetting to 0 on entity change), but no equivalent reset/keying was added for dqIndicatorCounts.

Failing Test

A Jest repro test was executed using a single MemoryRouter and client-side navigation from /table/table_a to /table/table_b while table B’s DQ calls were deferred. While table B’s header was already rendered, the DQ badge still showed table A’s data-level="failing" until the deferred promises resolved (then the badge disappeared for all-zero counts).

Recommended Fix

Reset the counts on table change so the previous table’s badge cannot paint while fetches are in flight:

useEffect(() => {
  setDqIndicatorCounts(EMPTY_DQ_INDICATOR_COUNTS);
}, [loadedTableFqn]);

History

This bug was introduced in commit 7609c8ce5d ("Fixes #34207: Keep table DQ indicator visible while an incident is open (#34555)") which added dqIndicatorCounts and its fetch logic but placed the only synchronous reset inside the alerts-disabled early-return branch; in the alerts-enabled path the previous table’s counts persist until the new fetch completes.

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
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions