Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Textarea] Add back defensive branch logic #12406

Merged
merged 3 commits into from
Aug 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = [
name: 'The size of all the modules of material-ui.',
webpack: true,
path: 'packages/material-ui/build/index.js',
limit: '95.7 KB',
limit: '95.8 KB',
},
{
name: 'The main bundle of the docs',
Expand Down
7 changes: 7 additions & 0 deletions packages/material-ui/src/Input/Textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ class Textarea extends React.Component {
syncHeightWithShadow() {
const props = this.props;

// Guarding for **broken** shallow rendering method that call componentDidMount
// but doesn't handle refs correctly.
// To remove once the shallow rendering has been fixed.
if (!this.shadowRef) {
return;
}

if (this.isControlled) {
// The component is controlled, we need to update the shallow value.
this.shadowRef.value = props.value == null ? '' : String(props.value);
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Input/Textarea.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('<Textarea />', () => {
let mount;

before(() => {
shallow = createShallow({ disableLifecycleMethods: true });
shallow = createShallow();
mount = createMount();
});

Expand Down