Skip to content

Commit

Permalink
More block: Fix React warning when adding custom text (WordPress#61936)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ellatrix <[email protected]>
  • Loading branch information
3 people authored and patil-vipul committed Jun 17, 2024
1 parent de35b06 commit e309c2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/more/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"textdomain": "default",
"attributes": {
"customText": {
"type": "string"
"type": "string",
"default": ""
},
"noTeaser": {
"type": "boolean",
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/more/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default function MoreEdit( {
} ) {
const onChangeInput = ( event ) => {
setAttributes( {
customText:
event.target.value !== '' ? event.target.value : undefined,
customText: event.target.value,
} );
};

Expand Down
1 change: 1 addition & 0 deletions test/integration/fixtures/blocks/core__more.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "core/more",
"isValid": true,
"attributes": {
"customText": "",
"noTeaser": false
},
"innerBlocks": []
Expand Down

0 comments on commit e309c2f

Please sign in to comment.