Fix test suite tab loading race#29561
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
🟡 Playwright Results — all passed (47 flaky)✅ 4430 passed · ❌ 0 failed · 🟡 47 flaky · ⏭️ 38 skipped
🟡 47 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|
Code Review ✅ ApprovedImplements a loading state and stale response ignore logic to resolve test suite tab race conditions. Includes unit and E2E regression coverage to ensure reliable data fetching. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |



Description
Tests
./node_modules/.bin/jest src/components/DataQuality/TestSuite/TestSuiteList/TestSuites.test.tsx --runInBandPages/TestSuite.spec.tsgit diff --checkFixes open-metadata/openmetadata-collate#4741
Screen.Recording.2026-06-29.at.7.32.31.PM.mov
Greptile Summary
This PR fixes a race condition in the TestSuites component where switching between table suites and bundle suites could cause a stale API response to overwrite the newly loaded data. The fix uses an incrementing request-ID ref (
latestRequestId) to discard out-of-order responses, and adds an inlineLoaderto the table body while data is in flight.fetchTestSuitesnow stamps each call with a monotonically incrementing ID and short-circuits state updates intry/catch/finallyif the request is no longer current, so a delayed table-suite response can never replace bundle-suite data.isLoadingis set totrueat the start of every fetch, forcingTable.Bodyto render the empty-state slot with aLoaderspinner rather than stale rows.Confidence Score: 5/5
Safe to merge — the change is a targeted, well-tested fix for a UI race condition with no effect on data persistence or API contracts.
The monotonic request-ID pattern is correct and idiomatic: each fetch captures its own ID before any await, the ref is updated synchronously, and all three outcome branches guard against stale updates. Both unit tests and the E2E test reproduce the exact race sequence from the bug report. No regressions are introduced in unrelated code paths.
No files require special attention.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant U as User participant C as TestSuites Component participant API as API (getListTestSuitesBySearch) Note over C: latestRequestId.current = 0 U->>C: Navigate to Table Suites tab C->>C: "requestId=1, latestRequestId=1, setIsLoading(true)" C->>API: "fetch(testSuiteType=basic)" Note over API: Response delayed… U->>C: Switch to Bundle Suites tab C->>C: "requestId=2, latestRequestId=2, setIsLoading(true)" C->>API: "fetch(testSuiteType=logical)" API-->>C: "Bundle suites response (requestId=2)" C->>C: "2 === latestRequestId(2) ✓ setTestSuites(bundleData), setIsLoading(false)" API-->>C: "Stale table suites response (requestId=1)" C->>C: 1 ≠ latestRequestId(2) → DISCARD (no state update)%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant U as User participant C as TestSuites Component participant API as API (getListTestSuitesBySearch) Note over C: latestRequestId.current = 0 U->>C: Navigate to Table Suites tab C->>C: "requestId=1, latestRequestId=1, setIsLoading(true)" C->>API: "fetch(testSuiteType=basic)" Note over API: Response delayed… U->>C: Switch to Bundle Suites tab C->>C: "requestId=2, latestRequestId=2, setIsLoading(true)" C->>API: "fetch(testSuiteType=logical)" API-->>C: "Bundle suites response (requestId=2)" C->>C: "2 === latestRequestId(2) ✓ setTestSuites(bundleData), setIsLoading(false)" API-->>C: "Stale table suites response (requestId=1)" C->>C: 1 ≠ latestRequestId(2) → DISCARD (no state update)Reviews (4): Last reviewed commit: "Merge branch 'main' into codex/test-suit..." | Re-trigger Greptile