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

Empty Post Content in Pages doesn't always contain initial template #50984

Open
tellthemachines opened this issue May 26, 2023 · 1 comment
Open
Labels
[Block] Post Content Affects the Post Content Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@tellthemachines
Copy link
Contributor

Description

#50623 added a template with a single Paragraph to Post Content block so that the block is always visible (via the paragraph's placeholder prompt) when opening an empty page in the site editor. This works fine if the site is set to display a static page as the homepage, but if homepage is set to display latest posts, the template only displays for the first page loaded in the site editor.

Step-by-step reproduction instructions

  1. Make sure site is set to display latest posts in homepage (under Reading settings);
  2. Create a couple of pages, at least one of which should have no content;
  3. Go to site editor > Pages
  4. Click on the page without content first, check that the paragraph placeholder inside it is visible;
  5. Go back to Pages view and reload;
  6. Now click on another page first, and then go back and click on the empty page;
  7. Verify that placeholder is not visible this time around.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@tellthemachines tellthemachines added [Type] Bug An existing feature does not function as intended [Block] Post Content Affects the Post Content Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels May 26, 2023
@youknowriad
Copy link
Contributor

youknowriad commented May 26, 2023

This is what I've found so far: there's something wrong in the state but I can't tell yet where the original thing that creates this issue is:

At some point in the lifecycle of the block-editor "reducer" we end up with a block that:

  • has no children in "state.blocks.order[id]"
  • has children in "state.blocks.tree['controlled||' + id].innerBlocks"

The second one is supposed to be a denormalization, so there's something wrong in the reducer at some point but I can't pinpoint. Some action is clearning the former without clearing the latter which end up with a wrong value returned by getBlocks( id ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Content Affects the Post Content Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants