[fix] Restore layered vconcat width propagation and add #13974 regression tests#13980
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
SummaryThis PR fixes a bug (#13974) where layered Altair charts inside Files changed:
Code QualityThe code change is minimal, well-scoped, and correct. The distinction between The updated comments in Minor note: the Test CoverageUnit tests (
E2E tests (
One observation: the removal of Backwards CompatibilityThe change is fully backwards compatible:
Security & RiskNo security concerns identified. The change is limited to frontend spec preprocessing logic with no impact on data handling, authentication, or external communication. Risk is low: the fix is a single-line condition change that aligns AccessibilityNo accessibility impact. This PR changes chart rendering logic only; no DOM structure, ARIA attributes, keyboard interactions, or focus management are affected. Recommendations
VerdictAPPROVED: Well-scoped, correct bugfix with appropriate unit and E2E test coverage. The semantic distinction between This is an automated AI review by |
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression introduced in PR #13423 where layered Altair charts inside vconcat compositions with autosize="fit-x" and width="stretch" stopped rendering. The issue was that the width propagation logic was skipping all composition operators including layer, but layer children need to receive width to render correctly within vertical concatenations.
Changes:
- Modified the width propagation logic to only skip width on nested concatenation operators (hconcat, vconcat, concat) while allowing layer children to receive width
- Updated unit tests to reflect the corrected behavior
- Added an E2E regression test to guard against this specific issue in the future
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontend/lib/src/components/elements/ArrowVegaLiteChart/useVegaElementPreprocessor.ts |
Removed "layer" from the composition operator check, allowing layer children to receive width from their vconcat parent |
frontend/lib/src/components/elements/ArrowVegaLiteChart/useVegaElementPreprocessor.test.ts |
Removed incorrect parametrized test case and added new test verifying layer children receive width |
e2e_playwright/st_altair_chart.py |
Added regression test case with layered vconcat chart using autosize="fit-x" and width="stretch" |
e2e_playwright/st_altair_chart_test.py |
Added dedicated regression test function and updated chart count constants |
c6d9537 to
1f40a79
Compare
Consolidated Code ReviewSummaryThis PR fixes a rendering regression (issue #13974) where Altair charts containing a Root cause: PR #13423 (commit Changes:
Reviewer AgreementBoth reviewers (
No disagreements or conflicts to resolve. Code QualityThe code change is minimal and well-targeted — a single condition removed from an The unit test restructuring is appropriate: the old Test CoverageUnit tests: The new standalone test properly validates that vconcat children containing E2E tests: The regression test checks chart visibility, correct Backwards CompatibilityNo API or protocol changes. This restores the behavior from before PR #13423 specifically for Security & RiskNo security concerns. Regression risk is low: the change is narrowly scoped, covered by both unit and E2E tests, and the existing marginal histogram chart test (which uses AccessibilityNo accessibility impact — changes are limited to chart spec preprocessing logic and E2E test infrastructure. Minor Suggestions (Non-blocking)
VerdictAPPROVED — Clean, well-scoped bug fix that correctly restores width propagation for Consolidated review by 📋 Review by `gpt-5.3-codex-high`SummaryThis PR fixes a regression in Vega-Lite preprocessing where Code QualityThe implementation is focused and low-risk: Test CoverageCoverage is strong for this bug fix:
Together these tests exercise both the preprocessing logic and full-stack rendering behavior for the regression path. Backwards CompatibilityNo API or protocol changes were introduced. The behavioral change is targeted to a previously broken composition case and aligns with expected Security & RiskNo security issues identified. Regression risk appears low because:
AccessibilityNo frontend interaction or semantic UI control changes were introduced in this PR. Accessibility impact is neutral. Recommendations
VerdictAPPROVED: The fix is focused, well-tested across unit and e2e layers, and appears safe to merge. This is an automated AI review by 📋 Review by `opus-4.6-thinking`SummaryThis PR fixes a rendering bug (issue #13974) where Altair charts containing a The root cause: commit Changes:
Code QualityThe code change is minimal and well-targeted -- a single condition removed from an The unit test was properly restructured: the old parameterized test case for The E2E test modifications are also well done:
Test CoverageUnit tests: The new standalone test in E2E tests: The
One minor note: the regression test does not include a snapshot comparison. This is acceptable since the primary concern is whether the chart renders at all (vs. breaking with infinite extent), and snapshot tests can be brittle for charts with randomized data. The test appropriately uses Backwards CompatibilityThis change restores the behavior from before PR #13423 specifically for Security & RiskNo security concerns. The change is a narrowing of a conditional check in client-side spec preprocessing. Risk is low:
AccessibilityNo accessibility impact. The changes are limited to chart spec preprocessing logic and E2E test infrastructure. No UI component structure, ARIA attributes, or keyboard interaction patterns were modified. RecommendationsNo blocking issues. Minor suggestions:
VerdictAPPROVED: Clean, well-scoped bug fix that correctly restores width propagation for This is an automated AI review by |
…sion tests (#13980) ## Describe your changes Fixed a bug where layered Altair charts inside vconcat compositions with `autosize="fit-x"` and `width="stretch"` weren't rendering properly. The issue was in the `useVegaElementPreprocessor` where we were skipping setting width on layer children, causing "infinite extent" errors. This change ensures that layer children still receive width so layered + vconcat charts can stretch consistently. ## GitHub Issue Link (if applicable) Fixes #13974 ## Testing Plan - Added a regression test case in the e2e_playwright/st_altair_chart.py file that demonstrates the issue - Added a new test in st_altair_chart_test.py to verify the fix works properly - Updated the unit test in useVegaElementPreprocessor.test.ts to better test the layer + vconcat case --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
|
FWIW, this improved a vconcat with st.altair_chart(
alt.vconcat(*charts),
width='stretch',
) |
|
Thanks for the comment here @ndawe. Can you open up a new issue with clear repro code? Thanks! |
|
@sfc-gh-bnisco yes, I'll try to reproduce with a simple example and open an issue here if it seems to be a streamlit regression. Based on the positioning of surrounding elements, I'm also suspecting that I might be dealing with an altair issue. |

Describe your changes
Fixed a bug where layered Altair charts inside vconcat compositions with
autosize="fit-x"andwidth="stretch"weren't rendering properly. The issue was in theuseVegaElementPreprocessorwhere we were skipping setting width on layer children, causing "infinite extent" errors. This change ensures that layer children still receive width so layered + vconcat charts can stretch consistently.GitHub Issue Link (if applicable)
Fixes #13974
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.