Skip to content

fix: Stop Legacy chart oscllation in Board Components#4672

Draft
NathanZlion wants to merge 2 commits into
mainfrom
dev-v3-natidere-fix-chart-oscillation
Draft

fix: Stop Legacy chart oscllation in Board Components#4672
NathanZlion wants to merge 2 commits into
mainfrom
dev-v3-natidere-fix-chart-oscillation

Conversation

@NathanZlion

@NathanZlion NathanZlion commented Jun 27, 2026

Copy link
Copy Markdown
Member

Description

Fixes "Maximum update depth exceeded" oscillation in legacy charts

Issue:
Caused since PR #3018 added an inner wrapper inside .content-fit-height to fix the table sticky scrollbar floating above content (AWSUI-54814). (Had to do a binary search to find the exact place since issue existed). Verified this is the cause by undoing this cmmit and checking if it fixed the issue and it did.

The wrapper uses display: flex; flex-direction: column on the outer with flex: 1 on the inner. This allocates widths to the inner wrapper, which feeds back into LabelsMeasure's ResizeObserver and prevents the chart's auto-width measurement from stabilizing.

So with this change the original issue for which the PR was a fix for is still addressed without it causing issue with the Board Component.

Related links, issue AWSUI-62091,

How has this been tested?

Before:

Screen.Recording.2026-06-16.at.7.40.01.PM.mov

After:

Screen.Recording.2026-06-28.at.12.49.16.AM.mov

  1. Run a board-components dev page that renders a legacy BarChart or MixedLineBarChart inside <BoardItem>. The page used during video: widget-container/content-permutations.
  2. Before this change: charts oscillate visibly with react logs Warning: Maximum update depth exceeded repeatedly.
  3. After this change: charts render cleanly, no console warnings.
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

… oscillation

PR #3018 (AWSUI-54814) introduced a flex column layout on .content-fit-height
with a flex:1 inner wrapper to fix the table sticky scrollbar floating above
the table content. Flex's sub-pixel space distribution makes the inner
wrapper's content-box width oscillate by fractions of a pixel under certain
conditions, which feeds back into LabelsMeasure's ResizeObserver and causes
'Maximum update depth exceeded' in legacy charts (BarChart, MixedLineBarChart,
PieChart) inside fit-height containers — most visibly inside board-components
BoardItem.

CSS Grid with grid-template-rows: 1fr uses an integer-pixel track sizing
algorithm, so the inner wrapper gets a stable integer width and the
ResizeObserver feedback loop terminates after one cycle. The structural change
(outer scrolling wrapper, inner padding wrapper) is preserved, so the original
AWSUI-54814 sticky scrollbar fix continues to work.

Bisect notes (board-components content-permutations dev page):
  components 3.0.836 -> CLEAN
  components 3.0.837 -> BROKEN (PR #3018 lands)
  components HEAD with Option D (CSS Grid) -> CLEAN
  components HEAD with min-block-size: 100% (no flex) -> STILL OSCILLATES
  components HEAD with flex: 1 1 auto -> STILL OSCILLATES

Rel: AWSUI-62091
Rel: AWSUI-54814 (regression guard)
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (902b5ad) to head (1d39c42).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4672   +/-   ##
=======================================
  Coverage   97.57%   97.57%           
=======================================
  Files         948      948           
  Lines       30489    30491    +2     
  Branches    11148    11150    +2     
=======================================
+ Hits        29749    29751    +2     
  Misses        733      733           
  Partials        7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NathanZlion NathanZlion marked this pull request as ready for review June 29, 2026 08:43
@NathanZlion NathanZlion requested a review from a team as a code owner June 29, 2026 08:43
@NathanZlion NathanZlion requested review from gethinwebster and removed request for a team June 29, 2026 08:43
@NathanZlion NathanZlion marked this pull request as draft July 1, 2026 00:02
…height inner

Follow-up to the CSS Grid switch. Two related sizing issues surfaced in
the board-components content-permutations screenshot tests once the
inner wrapper became a grid item:

1. Vertical: legacy charts inside fitHeight use a nested <svg
   height="100%"> and measure its rendered height via useHeightMeasure.
   With min-block-size: 0 alone on the grid item, the inner wrapper's
   block-size is indefinite for percentage resolution, so the SVG falls
   back to its intrinsic viewport height. That produces a plot much
   larger than the widget and pushes the bars/legend off-screen.
   Fix: add block-size: 100% so descendants have a definite parent
   height to resolve against — matches the resolved-size behavior of
   the original flex: 1 layout without reintroducing flex's sub-pixel
   width distribution.

2. Horizontal: without an explicit column track, the grid falls back to
   an implicit auto column that grows to the widest child's max-content,
   letting wide inner content overflow the container instead of being
   scrolled by overflow: auto.
   Fix: grid-template-columns: minmax(0, 1fr) on the outer + min-inline-
   size: 0 on the inner, which replicates flex's align-items: stretch:
   the inner is exactly one parent width, wide content overflows the
   inner, and .content-fit-height's overflow: auto handles scrolling.

Verified against board-components content-permutations page (Firefox
screenshot test AWS-UI-IntegrationTests board-components-Firefox-local-
light-console-comfortable).

Rel: AWSUI-62091
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.

1 participant