Repository navigation
Revert "perf(Breadcrumbs): rebuild overflow menu for fewer renders, c… - #8747
francinelucca wants to merge 1 commit into
Conversation
…heaper l…" This reverts commit 32d5061.
|
|
There was a problem hiding this comment.
🟡 Changes recommended
The collapse loop can remove the only breadcrumb and run indefinitely, freezing rendering, while stale measurements and empty overflow menus introduce additional defects.
3 open issues
What changed in this PR
Reverts the Breadcrumbs overflow performance rewrite after regressions were found in GitHub testing, restoring the previous implementation in @primer/react.
Changes:
- Restores the
<details>-based overflow menu and measurement-driven collapse logic. - Removes pre-hydration layout rules and associated real-layout and server-rendering tests.
- Reverts the related Vitest dependency override and removes the performance changeset.
| File | Description |
|---|---|
packages/react/vitest.config.mts |
Removes the Octicons dependency-inlining override. |
packages/react/src/Breadcrumbs/Breadcrumbs.tsx |
Restores the previous overflow menu and width calculations. |
packages/react/src/Breadcrumbs/Breadcrumbs.module.css |
Removes collapsed-item measurement and pre-hydration styles. |
packages/react/src/Breadcrumbs/__tests__/BreadcrumbsOverflow.test.tsx |
Deletes the added real-layout, performance, and hydration tests. |
packages/react/src/Breadcrumbs/__tests__/Breadcrumbs.test.tsx |
Updates menu selectors to target <details> elements. |
packages/react/src/__tests__/ssr.test.tsx |
Removes Breadcrumbs server-rendering assertions. |
.changeset/breadcrumbs-overflow-performance.md |
Removes the release note for the reverted optimization. |
Review effort: Balanced
| (overflow === 'menu' || overflow === 'menu-with-root') && | ||
| (visibleItemsWidthTotal > availableWidth || currentVisibleItemWidths.length > MIN_VISIBLE_ITEMS) |
| if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) { | ||
| const widths = Array.from(listElement.children).map(child => (child as HTMLElement).offsetWidth) | ||
| setChildArrayWidths(widths) |
| const visibleItems = childArray.slice(menuItemCount) | ||
|
|
||
| // In 'menu-with-root' mode the root stays visible, so drop it from the menu. | ||
| const effectiveMenuItems = effectiveHideRoot ? menuItems : menuItems.slice(1) |


…heaper l…"
This reverts commit 32d5061. Found regressions when testing in dotcom so removing.
Closes #
Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing