Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Fix an issue with the Textarea in the Repeater
Browse files Browse the repository at this point in the history
Like the issue we saw in #409,
where empty values were exchanged incorrectly.
  • Loading branch information
kienstra committed Sep 4, 2019
1 parent 25d1664 commit c3c5a2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/blocks/controls/textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const { TextareaControl } = wp.components;

const BlockLabTextareaControl = ( props ) => {
const { getValue, field, onChange } = props
const initialValue = getValue( props );
const value = 'undefined' !== typeof initialValue ? initialValue : field.default;

return (
<TextareaControl
Expand All @@ -10,8 +12,7 @@ const BlockLabTextareaControl = ( props ) => {
maxLength={ field.maxlength }
rows={ field.number_rows }
help={ field.help }
defaultValue={ field.default }
value={ getValue( props ) }
value={ value }
onChange={ onChange }
/>
);
Expand Down

0 comments on commit c3c5a2e

Please sign in to comment.