Skip to content

Conversation

@Niki-Tester
Copy link
Contributor

@Niki-Tester Niki-Tester commented Jan 14, 2026

Description

Fixed the sortCrumbs comparator function in useBreadcrumbs.js to use subtraction - instead of the greater-than operator >.

The > operator returns a boolean (true/false) which coerces to 1 or 0. Since it never returns a negative number, Array.sort() cannot reliably determine when element a should come before element b, leading to unpredictable breadcrumb ordering.

Related Issue

Closes #4591

Acceptance

Verification Stakeholders

Specification

Verification Steps

Test scenario(s) for direct fix/feature

  1. Navigate to a category page with 3+ levels of nesting (e.g., /category-a/category-b/category-c)
  2. Verify breadcrumbs are displayed in correct hierarchical order (root → leaf)
  3. Test with different category depths (2, 3, 4+ levels)

Test scenario(s) for any existing impacted features/areas

  1. Verify breadcrumb links navigate to correct category pages
  2. Verify breadcrumb styling/appearance is unchanged
  3. Verify breadcrumbs update correctly when navigating between different category pages

Test scenario(s) for any Magento Backend Supported Configurations

N/A

Is Browser/Device testing needed?

No, this is a JavaScript logic fix that behaves consistently across all browsers and devices.

Any ad-hoc/edge case scenarios that need to be considered?

Screenshots / Screen Captures (if appropriate)

N/A

Breaking Changes (if any)

None.

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

@pwa-studio-bot
Copy link
Collaborator

Fails
🚫

node failed.

Log

ERROR ON TASK: cypressTests


Error:  Danger had errors running. See message(s) above for more details.
danger-results://tmp/danger-results.json

Generated by 🚫 dangerJS against dbe7ccd

@pwa-studio-bot
Copy link
Collaborator

Fails
🚫

node failed.

Log

ERROR ON TASK: cypressTests


Error:  Danger had errors running. See message(s) above for more details.
danger-results://tmp/danger-results.json

Generated by 🚫 dangerJS against dbe7ccd

@pwa-studio-bot
Copy link
Collaborator

Fails
🚫

node failed.

🚫 A version label is required. A maintainer must add one.
🚫

GraphQL queries did not pass. Make sure to execute yarn run validate-queries locally prior to committing.

🚫

Unit tests in the following files did not pass 😔. All tests must pass before this PR can be merged

  • packages/pwa-buildpack/lib/WebpackTools/targetables/__tests__/TargetableReactComponent.spec.js
🚫

The following file(s) were not formatted with prettier. Make sure to execute yarn run prettier locally prior to committing.

packages/venia-concept/webpack.config.js
Messages
📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next pr-test build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Log

ERROR ON TASK: prettierCheck


ERROR ON TASK: unitTests


ERROR ON TASK: validateQueries


Error:  Danger had errors running. See message(s) above for more details.
danger-results://tmp/danger-results.json

Generated by 🚫 dangerJS against dbe7ccd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Breadcrumbs sortCrumbs function uses > instead of -, causing unreliable sort order

2 participants