Skip to content

Commit

Permalink
More block: Fix React warning when adding custom text (#61936)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
3 people committed May 24, 2024
1 parent b902cf8 commit 417f6ea
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 417f6ea

Please sign in to comment.