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

Fix homepage-articles block not parsing nested inner blocks #1878

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

kevin940726
Copy link
Contributor

@kevin940726 kevin940726 commented Sep 10, 2024

All Submissions:

Changes proposed in this Pull Request:

Related to Automattic/wp-calypso#91839. This will also need a sync to https://github.com/Automattic/jetpack.

The Homepage Posts block (or the Blog Posts block in calypso and jetpack) won't load in the site editor. This is because the block fails to discover itself with getBlocks. This was partially fixed in #1066 but didn't take nested inner blocks into accounts. Since the core/post-content block is similar, this PR recursively calls getBlocks on all nested inner blocks.

How to test the changes in this Pull Request:

Test with wp-now locally:

  1. Switch to this branch and run npm install.
  2. Run npm start to build the blocks locally.
  3. Run npx @wp-now/wp-now start, it should open a webpage.
  4. Go to Pages -> Sample Page.
  5. Add a Homepage Posts block at the end of the page and expect it to display correctly.
  6. Save the page. Then, go to Appearance -> Editor -> Pages -> Sample Page to open the same page in the site editor.
  7. Expect the block to display correctly in the site editor as well.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@kevin940726 kevin940726 changed the title Fix articles block fail to get all inner blocks Fix homepage-articles block not parsing nested inner blocks Sep 10, 2024
Copy link
Member

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Nice work fixing this @kevin940726! I could reproduce the issue, where the block was stuck in a loading state when viewed while editing a page within the site editor. With this PR applied, the loading state concludes and the block renders as expected in the site editor 👍

Before After
image image

The approach for recursively getting blocks sounds good to me, but it'd be good to get a second review / approval from @Automattic/newspack-product too 🙂

@kevin940726
Copy link
Contributor Author

Hi! Any news on this? Just a friendly reminder in case I'm missing something 🙏.

@leogermani leogermani merged commit c699724 into trunk Oct 3, 2024
9 checks passed
@leogermani leogermani deleted the fix/articles-infinite-loading branch October 3, 2024 14:32
@leogermani
Copy link
Contributor

Thanks @kevin940726 and sorry for the delay. This will be added to the alphas in the next few days and should be part of the Oct 14 release.

matticbot pushed a commit that referenced this pull request Oct 14, 2024
## [4.2.3-alpha.1](v4.2.2...v4.2.3-alpha.1) (2024-10-14)

### Bug Fixes

* articles block fail to get all inner blocks ([#1878](#1878)) ([c699724](c699724))
* deprecate video playlist block ([#1903](#1903)) ([4876de6](4876de6))
* potential fatal with invalid attribute combo ([#1900](#1900)) ([adf2e9d](adf2e9d))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.2.3-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Oct 23, 2024
## [4.2.4-alpha.1](v4.2.3...v4.2.4-alpha.1) (2024-10-23)

### Bug Fixes

* articles block fail to get all inner blocks ([#1878](#1878)) ([c699724](c699724))
* deprecate video playlist block ([#1903](#1903)) ([4876de6](4876de6))
* potential fatal with invalid attribute combo ([#1900](#1900)) ([adf2e9d](adf2e9d))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.2.4-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Oct 28, 2024
## [4.3.1](v4.3.0...v4.3.1) (2024-10-28)

### Bug Fixes

* articles block fail to get all inner blocks ([#1878](#1878)) ([c699724](c699724))
* deprecate video playlist block ([#1903](#1903)) ([4876de6](4876de6))
* potential fatal with invalid attribute combo ([#1900](#1900)) ([adf2e9d](adf2e9d))
* update block classes for the site editor ([#1920](#1920)) ([1a07ad0](1a07ad0))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

5 participants