Skip to content

REST API: Omit content.rendered from preloaded post data #18988

@mikeselander

Description

@mikeselander

Describe the bug

The Block Editor is pre-loading API requests into the store via this set of logic and this REST API function. This is a very good thing for initial editor load times, but it has a strange side-effect of triggering the full rendered post content to be preloaded with the request.

Loading in the rendered post content has some strange side effects and can cause unintended behavior. As an example, any shortcodes or dynamic blocks are fully rendered in this request. This means that any API requests or heavy computations that either undertake are performed on the server (affecting TTFB) and then again in ServerSideRender in the case of dynamic blocks. Additionally, it means that the blob sent to the client is significantly larger, but that's a much smaller issue.

This is likely not an easy fix and would involve adjusting the way that the REST API returns fields in a given context. It sounds like this may be somewhat in hand already after talking to @kadamwhite.

Related: #18394 is caused by this behavior and is a good example of unintended side effects.

Expected behavior
I would expect that post content is rendered only on the client side when editing a given post.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions