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

More block: Fix React warning when adding custom text #61936

Merged
merged 3 commits into from
May 24, 2024
Merged
Changes from 1 commit
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 packages/block-library/src/more/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getDefaultBlockName, createBlock } from '@wordpress/blocks';
const DEFAULT_TEXT = __( 'Read more' );

export default function MoreEdit( {
attributes: { customText, noTeaser },
attributes: { customText = '', noTeaser },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a default to the attribute definition? I think that's what a lot of blocks do

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes, attribute updates require deprecations. I think undefined values don't get serialized, while empty does.

I can double-check, but adding deprecation for a simple fix like this is probably not worth it. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellatrix, I was wrong. It looks like there's no need for deprecation, at least for the current case.

insertBlocksAfter,
setAttributes,
} ) {
Expand Down
Loading