Skip to content

fix: footer logo field#1034

Merged
benlife5 merged 3 commits intomainfrom
fix-footer-logo
Feb 6, 2026
Merged

fix: footer logo field#1034
benlife5 merged 3 commits intomainfrom
fix-footer-logo

Conversation

@benlife5
Copy link
Contributor

@benlife5 benlife5 commented Feb 6, 2026

AI was outputting weird data for the footer logo -> the type is set to YextEntityField but the field configuration was a non-entity field image

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Walkthrough

The PR widens FooterLogoSlot's public image prop to accept ImageType and ComplexImageType in addition to AssetImageType and TranslatableAssetImage. Internal resolution now normalizes various image shapes into a simplified image, uses a shared getImageUrl(image, locale) to compute the URL, and uses getImageAltText(image, locale, document) for alt text. The editor field config for the slot changes from type: "image" to type: "entityField" filtered to type.image. Supporting helpers were added/exported and imports/typing adjusted.

Sequence Diagram(s)

sequenceDiagram
    participant Editor as Editor (slot data)
    participant Footer as FooterLogoSlot
    participant Resolver as resolveComponentData
    participant Utils as getImageUrl / getImageAltText
    participant ImageCmp as Image component
    Editor->>Footer: provide data.image (various image shapes)
    Footer->>Resolver: resolveComponentData(data.image)
    Resolver-->>Footer: resolvedImage (ImageType|ComplexImageType|TranslatableAssetImage|...)
    Footer->>Utils: getImageUrl(resolvedImage, locale)
    Utils-->>Footer: imageUrl
    Footer->>Utils: getImageAltText(resolvedImage, locale, streamDocument)
    Utils-->>Footer: altText
    Footer->>ImageCmp: render with simplifiedImage / imageUrl / altText
    ImageCmp-->>Footer: rendered <img>
Loading

Possibly related PRs

Suggested reviewers

  • asanehisa
  • mkilpatrick
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: footer logo field' clearly and directly describes the main change: fixing the footer logo field configuration and type mismatch.
Description check ✅ Passed The description is directly related to the changeset, explaining the specific issue being fixed: a mismatch between the YextEntityField type and non-entity field configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-footer-logo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/visual-editor/src/components/footer/FooterLogoSlot.tsx (1)

120-138: ⚠️ Potential issue | 🟠 Major

Default constantValue structure uses TranslatableString for alternateText — confirm this is handled correctly downstream.

Line 129 sets alternateText: { en: "Logo", hasLocalizedValue: "true" }, which is a TranslatableString object. Since the useMemo casts it to ImageType (which expects alternateText?: string), this default will exhibit the [object Object] alt-text issue mentioned above until the alternateText resolution is fixed.

🤖 Fix all issues with AI agents
In `@packages/visual-editor/src/components/footer/FooterLogoSlot.tsx`:
- Around line 33-60: The image alternateText (AssetImageType.alternateText) is
still a TranslatableString object and must be localized before use; update the
image resolution in FooterLogoSlot by calling
resolveComponentData(image?.alternateText, i18n.language, streamDocument)
(similar to FooterUtilityImagesSlot/PhotoGalleryWrapper) and pass that resolved
string to ariaLabel/fallback logic instead of the raw object so ariaLabel
receives a string or undefined.
🧹 Nitpick comments (1)
packages/visual-editor/src/components/footer/FooterLogoSlot.tsx (1)

44-56: Unsafe narrowing: both AssetImageType and ImageType have "url", so the first branch swallows asset images without special handling.

The "url" in resolvedImage check (line 44) matches both ImageType and AssetImageType. If you intend different handling for AssetImageType (e.g., extracting the localized alternateText), you should check for the more specific type first:

+    // Check for AssetImageType first (has assetImage or TranslatableString alternateText)
+    if ("url" in resolvedImage && "assetImage" in resolvedImage) {
+      // Handle AssetImageType: resolve alternateText from TranslatableString
+      ...
+    }
+
     if ("url" in resolvedImage) {
       return resolvedImage as ImageType;
     }

Otherwise the AssetImageType-specific fields (like assetImage and the translatable alternateText) are silently discarded.

@benlife5 benlife5 merged commit 1e8a053 into main Feb 6, 2026
17 checks passed
@benlife5 benlife5 deleted the fix-footer-logo branch February 6, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants