Repository navigation
fix(ui): port renderIcon → <Icon> component to 1.13 (backport #31982) - #32066
Conversation
Adds the new Icon component (components/common/Icon/Icon.tsx) that renders icon names synchronously and image URLs with a loading skeleton + real onLoad/onError fallback, replacing the stateless renderIcon regex-only helper. Migrates all 1.13 call sites: - Certification.component, TagsV1, CertificationTag (preserves 1.13 size variants) - TagPage, ClassificationUtils, DataProductUtils, DomainUtils - MUIIconPicker (1.13-only call site not in main PR) Removes renderIcon from IconUtils.tsx and its tests from IconUtils.test.tsx. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
❌ 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! |
When a new tag is added the table unmounts and remounts <Icon> components. On remount loadState resets to 'loading' and the img is hidden. For already- cached images the browser fires the DOM load event synchronously while creating the <img> element — before React attaches its onLoad listener — so the event is silently dropped and the image stays hidden forever. Fix: add imgRef to the <img> and a second useEffect[loadState] that checks img.complete immediately after every 'loading' transition. If the browser already holds the image, complete is true right after mount and we resolve the state without waiting for the missed event. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
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! |
The <span> wrapper had no width/height of its own, causing two issues: - Layout shift between loading (Skeleton) and loaded (img) states because the span is display:inline and collapses to its child's size. - className passed by callers (e.g. certification-img) landed on the <span> rather than the <img>, breaking CSS selectors like img.certification-img. Fix: - Set display:inline-flex + width/height:size + flexShrink:0 on the span so the layout box is stable regardless of which child is visible. - Move className from <span> to <img> so element-type CSS selectors work. - Remove the now-redundant flexShrink:0 from TagsV1's wrapperStyle (the span provides it by default). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
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! |
JSX elements are always truthy objects, so `renderedIcon ?` was always
true whenever iconURL was set — even when <Icon> produced no visible
output. For certifications whose iconURL is neither in ICON_MAP nor a
valid image URL, <Icon> returned an empty fragment but the truthy check
still wrapped it in <div className="certification-icon">, leaving an
empty div.
Fix: remove the isIcon / renderedIcon variables and the 3-way conditional
entirely. Replace with a direct <Icon fallback={<CertificationIcon/>}> call
always inside .certification-icon, so every case (named icon, image URL,
unknown value, no iconURL) is handled correctly by the component itself.
Also drop the now-unused isImageUrl import.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
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! |
- Move IconProps to Icon.interface.ts per repo convention (greptile comment: prop interfaces belong in dedicated .interface.ts files) - Restore size=40 for image URLs in Certification.component.tsx — original 1.13 code used size=28 for named SVG icons and size=40 for image URLs; our migration collapsed both to 28 incorrectly The gitar-bot className comment is already resolved: className lands on <img> (not <span>) since the span-size fix commit. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
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]>
|
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! |
Code Review ✅ Approved 2 resolved / 2 findingsPorts the renderIcon utility to a stateful Icon component with robust image loading and fallback handling, addressing findings related to image certification icon sizes and wrapper class names. ✅ 2 resolved✅ Bug: Image certification icons shrink from 40px to 28px
✅ Quality: caller className now lands on wrapper span, not the <img>
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
❌ UI Checkstyle Failed❌ ESLint + Prettier + Organise Imports (src)One or more source files have linting or formatting issues. ❌ Core Components - I18n SyncCore-components ❌ Tailwind AuditHardcoded Tailwind values found. Use a design-system utility (run ❌ Antd + Less Deprecation GuardA new Affected filesat Function._resolveFilename (node:internal/modules/cjs/loader:1401:15) Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
|



Summary
Backport of #31982 to the
1.13branch.components/common/Icon/Icon.tsx— renders known icon names synchronously, shows a loading skeleton for image URLs and swaps to the real<img>or a caller-suppliedfallbackbased on actual browseronLoad/onErroroutcome, instead of pre-validating only the URL shape with a regex.renderIconfromutils/IconUtils.tsxand migrates all 1.13 call sites to<Icon>.CertificationTagpreservesshowName ? 16 : 28/showName ? 14 : 20size variants;DataProductUtils/DomainUtilsuse 1.13 class names (data-product-default-icon,domain-default-icon, notw:text-quaternary).MUIIconPicker.tsx(a 1.13-only call site not present in main).Files changed (13):
components/common/Icon/Icon.tsx(new)components/common/Icon/Icon.test.tsx(new)utils/IconUtils.tsx— removedrenderIconutils/IconUtils.test.tsx— removedrenderIcontestscomponents/Certification/Certification.component.tsxcomponents/Tag/TagsV1/TagsV1.component.tsxcomponents/common/CertificationTag/CertificationTag.tsxcomponents/common/CertificationTag/CertificationTag.test.tsxcomponents/common/IconPicker/MUIIconPicker.tsxpages/TagPage/TagPage.tsxutils/ClassificationUtils.tsxutils/DataProductUtils.tsxutils/DomainUtils.tsxFixes #29895
🤖 Generated with Claude Code
Greptile Summary
The PR replaces
renderIconwith a shared stateful<Icon>component and migrates the existing icon consumers.IconPropsinto the repository-standard dedicated interface file.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (6): Last reviewed commit: "fix(ui): remove padding from .certificat..." | Re-trigger Greptile