[Fix] Fix st.text_area height="content" not working#14228
[Fix] Fix st.text_area height="content" not working#14228lukasmasuch merged 4 commits intodevelopfrom
st.text_area height="content" not working#14228Conversation
Add uiValue to useTextInputAutoExpand dependencies so height recalculates when the default value is set.
✅ 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!
|
text_area height="content" not working
text_area height="content" not workingst.text_area height="content" not working
There was a problem hiding this comment.
Pull request overview
Fixes a regression where st.text_area(height="content") fails to auto-expand when the widget’s default value is applied after the initial auto-expand measurement (introduced around v1.55.0).
Changes:
- Updates the
useTextInputAutoExpanddependency list inTextAreato force an auto-height recalculation when the textarea value changes after mount (e.g., when default arrives).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Verifies the textarea auto-expands to fit its default value on initial render, catching the regression from issue #14222.
Address PR review feedback from Copilot and Cursor Bugbot. Using `value` (the committed backend value) instead of `uiValue` prevents unnecessary double DOM reflows on every keystroke while still recalculating height when the default value is applied.
SummaryThis PR fixes a regression in The fix adds Changed files:
Reviewer AgreementBoth reviewers (
Key Disagreement:
|
|
The AI review job failed to complete. Please check the workflow run for details. You can retry by adding the 'ai-review' label again or manually triggering the workflow. |
## Describe your changes Fixes regression in `st.text_area` with `height="content"` introduced in v1.55.0 (#14222). - Added `uiValue` to `useTextInputAutoExpand` dependencies so height recalculates when default value is set **Root cause:** PR #13901 removed `element.default` fallback from `getStateFromWidgetMgr`. The textarea starts empty when `useLayoutEffect` calculates auto-expand height; the default value arrives later via `useEffect` but height was never recalculated. ## GitHub Issue Fixes #14222 ## Testing Plan - [x] Unit Tests (`frontend/lib/src/components/widgets/TextArea/TextArea.test.tsx` — 28 tests pass) - [x] E2E Tests (`e2e_playwright/st_text_area_test.py::test_text_area_content_height_expansion` — passes) - [x] E2E Tests (`e2e_playwright/st_text_area_test.py::test_text_area_content_height_default_value` — new regression test) <!-- agent-metrics-start --> <details> <summary>Agent metrics</summary> | Type | Name | Count | |------|------|------:| | subagent | fixing-pr | 2 | </details> <!-- agent-metrics-end -->
Describe your changes
Fixes regression in
st.text_areawithheight="content"introduced in v1.55.0 (#14222).uiValuetouseTextInputAutoExpanddependencies so height recalculates when default value is setRoot cause: PR #13901 removed
element.defaultfallback fromgetStateFromWidgetMgr. The textarea starts empty whenuseLayoutEffectcalculates auto-expand height; the default value arrives later viauseEffectbut height was never recalculated.GitHub Issue
Fixes #14222
Testing Plan
frontend/lib/src/components/widgets/TextArea/TextArea.test.tsx— 28 tests pass)e2e_playwright/st_text_area_test.py::test_text_area_content_height_expansion— passes)e2e_playwright/st_text_area_test.py::test_text_area_content_height_default_value— new regression test)Agent metrics