Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

When use editEntityRecord for content it doesn't render automatically. #249

Open

Description

 const handlePageImport = async (page) => {
    const { getCurrentPostId, getCurrentPostType, getEditedPostContent } = select('core/editor');
    const { getEntityRecord } = select('core');
    const { editEntityRecord, saveEditedEntityRecord } = dispatch('core');
    const postId = getCurrentPostId();
    const postType = getCurrentPostType();
    const content = getEditedPostContent();
    const post = getEntityRecord('postType', postType, postId);
    await editEntityRecord('postType', postType, postId, {
        content: content + page.content,
    });
    await saveEditedEntityRecord('postType', postType, postId);
}

I used this code to import my demo from a custom post type. It imports my demo content to the page but doesn't render until I reload the page manually. After manually reloading I can see my demo content. but if I updated only the title then it's rendered automatically but only when I update the post manually.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions