Skip to content

chore: enable localization in breadcrumb localization#3289

Merged
hellofanny merged 4 commits intocanary-v2from
chore/enable-breadcrumb-localization-no-link
May 1, 2026
Merged

chore: enable localization in breadcrumb localization#3289
hellofanny merged 4 commits intocanary-v2from
chore/enable-breadcrumb-localization-no-link

Conversation

@hellofanny
Copy link
Copy Markdown
Contributor

@hellofanny hellofanny commented Apr 30, 2026

What's the purpose of this pull request?

  • Enables localization for breadcrumb
  • When localization is enabled, breadcrumb items render as plain text (non-clickable) instead of links, since slug translations are not yet available and the links would otherwise be broken.

How to test it?

  • You should be able to see the breadcrumb text translated according to the current locale.

Starters Deploy Preview

https://github.com/vtex-sites/brandless.store/pull/164

References

task

Summary by CodeRabbit

  • Bug Fixes

    • Breadcrumb items now render correctly based on localization settings, ensuring consistent behavior across different configurations.
  • Refactor

    • Simplified product data merging logic for improved performance and maintainability.

@hellofanny hellofanny requested a review from a team as a code owner April 30, 2026 20:49
@hellofanny hellofanny requested review from lemagnetic and lucasfp13 and removed request for a team April 30, 2026 20:49
@hellofanny hellofanny self-assigned this Apr 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Walkthrough

The changes modify two core components: the Breadcrumb component adds localization-aware conditional rendering (span vs. link), and the PDP page simplifies product data merging by removing custom overrides while adding explicit locale awareness to product queries.

Changes

Cohort / File(s) Summary
Breadcrumb Localization
packages/core/src/components/ui/Breadcrumb/Breadcrumb.tsx
Conditional rendering logic: renders non-link <span> when storeConfig.localization?.enabled is true, otherwise renders Link with prefetch={false}. Alters control flow based on runtime configuration.
PDP Product Data & Locale
packages/core/src/pages/[slug]/p.tsx
Removes custom post-merge override of product.isVariantOf.skuVariants; relies on deepmerge with arrayMerge configuration. Adds explicit locale facet to product query locator in getStaticProps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • lemagnetic
  • lucasfp13
  • lariciamota

Poem

🥖 Breadcrumbs trail where locales lead,
Non-linked spans when translation's freed.
Product merges, arrays aligned,
Locale facets now defined—
Config guards make UI kind. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: enable localization in breadcrumb localization' is vague and contains redundant phrasing ('breadcrumb localization' appears twice), making it unclear what the actual change accomplishes. Revise the title to be more specific and clear, such as 'chore: render breadcrumb items as text when localization is enabled' or 'chore: make breadcrumb non-clickable for localized content to avoid broken links'.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/enable-breadcrumb-localization-no-link

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.

@hellofanny hellofanny changed the title Chore: enable localization in breadcrumb localization chore: enable localization in breadcrumb localization Apr 30, 2026
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Apr 30, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/pages/`[slug]/p.tsx:
- Line 333: The JSON-LD generation is still using localized breadcrumb URLs even
though UI locale links are disabled; modify the BreadcrumbJsonLd output to guard
against publishing broken URLs by checking that slug localization is available
before mapping breadcrumbList.itemListElement to item.href (or omit the locale
param): wrap the BreadcrumbJsonLd render (or the code that builds
breadcrumbList.itemListElement.item) with a condition that verifies the
locale-enabled slug resolution (the same flag/source that controls { key:
'locale', value: locale }) and if not available, either skip rendering
BreadcrumbJsonLd or construct canonical non-localized URLs instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d30682b5-62b6-4274-b887-d54fc42c23a0

📥 Commits

Reviewing files that changed from the base of the PR and between aa03da9 and 97319d7.

📒 Files selected for processing (2)
  • packages/core/src/components/ui/Breadcrumb/Breadcrumb.tsx
  • packages/core/src/pages/[slug]/p.tsx

Comment thread packages/core/src/pages/[slug]/p.tsx
@hellofanny hellofanny merged commit e54c309 into canary-v2 May 1, 2026
5 of 6 checks passed
@hellofanny hellofanny deleted the chore/enable-breadcrumb-localization-no-link branch May 1, 2026 15:26
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.

2 participants