Skip to content

Fix breadcrumbs - #52

Merged
danielguillan merged 9 commits into
mainfrom
danielguillan/fix-breadcrumbs
Jun 26, 2025
Merged

Fix breadcrumbs#52
danielguillan merged 9 commits into
mainfrom
danielguillan/fix-breadcrumbs

Conversation

@danielguillan

@danielguillan danielguillan commented Jun 26, 2025

Copy link
Copy Markdown
Contributor

Fixes the issue of duplicate items on index pages and adds tabbed navigation labels to breadcrumbs.

Before After
screenshot-BGO9rYtr-000281@2x screenshot-UDQE1cxh-000282@2x
screenshot-ZNZdTP65-000288@2x screenshot-c5frWW9g-000287@2x
screenshot-qRWEMmg7-000289@2x screenshot-lXyswR7p-000290@2x

@danielguillan
danielguillan marked this pull request as ready for review June 26, 2025 09:53
@danielguillan
danielguillan requested a review from a team as a code owner June 26, 2025 09:53
@danielguillan
danielguillan marked this pull request as draft June 26, 2025 10:12
@danielguillan
danielguillan marked this pull request as ready for review June 26, 2025 10:29
Copilot AI review requested due to automatic review settings June 26, 2025 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Fix duplicate breadcrumb entries and add tab-based labels to navigation.

  • Filters out redundant index pages in the breadcrumb trail
  • Uses frontMatter tab-label for titles and updates the last-item selection logic
  • Adds a changeset entry for the patch release

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/theme/components/layout/root-layout/Theme.tsx Refactor breadcrumb rendering: filter duplicates, apply tab-label, and update selected
.changeset/cool-cows-shake.md Add patch changeset describing the breadcrumb fix
Comments suppressed due to low confidence (1)

packages/theme/components/layout/root-layout/Theme.tsx:153

  • Add unit tests covering scenarios for folder-index collisions and tab-label filtering to ensure the breadcrumb logic behaves as expected.
                                  .filter((item, index, array) => {

Comment thread packages/theme/components/layout/root-layout/Theme.tsx
Comment thread packages/theme/components/layout/root-layout/Theme.tsx
Comment thread packages/theme/components/layout/root-layout/Theme.tsx
Comment on lines +162 to +163
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
!nextItem.frontMatter?.['tab-label']) ||

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how to avoid disabling the linter here, the fontMatter check is actually necessary.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is checking for frontMatter required? I thought it was always available through Nextra, but empty if nothing was added there? If that's the case you could remove it the optional chain. Or are you trying to check if tab-label is available on the frontMatter object?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If frontMatter is optional, we need to adjust the types in types.ts to reflect that. But that will likely lead to a bigger job so in that case, let's leave as-is and mop up later.

@danielguillan
danielguillan requested a review from rezrah June 26, 2025 10:42

@rezrah rezrah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is looking great Dani.

@danielguillan
danielguillan merged commit dd67040 into main Jun 26, 2025
8 checks passed
@primer-css primer-css mentioned this pull request Jun 26, 2025
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