Repository navigation
fix(ui): reset TierCard selectedTier on close to prevent stale radio state - #33115
Conversation
…state Two bugs caused the tier radio button to show stale state: - Bug A: cancelling a tier change left the cancelled tier selected on reopen - Bug B: after a successful save, the old tier was shown on reopen because handleOpenChange closed over a stale currentTier before React propagated the updated prop Fix: extract handleOpenChange to reset selectedTier to currentTier on every close, and add a useEffect([currentTier]) guard that re-syncs when the prop updates while the popover is closed (covers the save-stale race). Adds unit tests (TierWidget.test.tsx) and a Playwright E2E spec (TierWidget.spec.ts) covering both scenarios. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
❌ 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! |
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…-sync The useEffect that re-syncs selectedTier on currentTier change was guarding with !popoverProps?.open, but uncontrolled usages (no popoverProps) have open === undefined (always falsy), so the reset fired mid-edit, silently discarding the user's in-progress selection. Fix: add isOpen state updated in handleOpenChange so the guard works for both controlled and uncontrolled usages. Also adds isOpen to the useEffect dependency array to satisfy react-hooks/exhaustive-deps. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
| Count | Rule |
|---|---|
| 1 | openmetadata-imports/no-circular-imports |
| 1 | react-hooks/exhaustive-deps |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/common/TierCard/TierCard.tsx:37:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/common/TierCard/TierCard.tsx:124:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'getTierData' and 'tierCardData.length'. Either include them or remove the dependency array. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
|



Describe your changes:
Fixes #
Two bugs in
TierCardcaused the tier radio button to show stale state:handleOpenChangeresetselectedTieron close, but the old inlineonOpenChangedidn't.currentTierbefore React propagated the updated prop from the entity context.Fix: extracted
handleOpenChangethat resetsselectedTier → currentTieron every close, and added auseEffect([currentTier])guard that re-syncs when the prop updates while the popover is closed (covers the save-stale race).Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Unit tests
openmetadata-ui/src/main/resources/ui/src/components/common/TierWidget/TierWidget.test.tsx— covers both bugs via directonOpenChangesimulation and prop rerender.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TierWidget.spec.ts— E2E regression spec covering both stale-state scenarios on a real table entity.Manual testing performed
UI screen recording / screenshots:
Not applicable — logic-only change; no visual layout changes.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.