Skip to content

Conversation

Mamaduka
Copy link
Member

What?

PR improves the note for the 'blockType.save' method, highlights its pure nature and improves restricted API examples.

Testing Instructions

None. Confirm that changes make sense.

@Mamaduka Mamaduka self-assigned this Jul 28, 2025
@Mamaduka Mamaduka added the [Type] Developer Documentation Documentation for developers label Jul 28, 2025
Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

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

I like the updates. Makes it more clear.

The one thing we may also want to call out though is that it won't just cause block validation issues. But also that it won't have the desired effect either. Using dynamic data doesn't mean that the block will actually display dynamic information.

When I used to give trainings / workshops it helped people when I explained that the save function was only there to generate a static string of HTML which gets saved to the database.

Because people often though that they could just write a react component there which would then render as react on the frontend. (Which arguably I still wish sometimes was how it worked 😅 just all in server components in WP 💀😅)

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka
Copy link
Member Author

@fabiankaegy,

The save function defines the way in which the different attributes should be combined into the final markup, which is then serialized into post_content.

The top description already alludes to that IMO. I'm out of ideas and open to suggestions.

iAPI also enables static save markup to become interactive.

@Mamaduka
Copy link
Member Author

I'm going to land this. I'll create a follow-up if anything "clever" comes to mind regarding the non-dynamic nature of the save method.

@Mamaduka Mamaduka merged commit 605b356 into trunk Jul 29, 2025
67 of 68 checks passed
@Mamaduka Mamaduka deleted the update/block-save-function-docs branch July 29, 2025 03:30
@github-actions github-actions bot added this to the Gutenberg 21.4 milestone Jul 29, 2025
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Jul 31, 2025
)

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants