WordPress / twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
405 stars 92 forks source link

Update Query Loop patterns with less posts per page #304

Closed ntsekouras closed 2 years ago

ntsekouras commented 2 years ago

Related: https://github.com/WordPress/gutenberg/issues/37072

Patterns are really hard to handle in terms of performance as they can contain many many blocks and we not only have to parse and render them, but also do some recursive checks about the allowed blocks settings.

While this is an issue we have to handle in general and in core, for now I think we need to 'lighten' the theme's Query Loop patterns regarding the number of posts it previews. The point of a pattern is to showcase some design and with some pre-selected blocks(the inner Post blocks, etc..). It's already opinionated about the number of posts, so we could just show the minimum number required to make the pattern show its point.

With the increasing number of patterns it's crucial to think of these performance problems when we create one - again this is something that core needs to find a way to handle better.

The problem is absolutely noticeable with this theme as the number of posts was really big, taking not only a really long time to preview them, but also (maybe)failing to preview them at all - I didn't wait too much time to see if they would eventually render. If you try to see Query patterns without this PR you can see it.

Notes

I removed some extra props that were not needed like displayLayout when list was used. I think we should do this for GB and core Query patterns as well.

ntsekouras commented 2 years ago

Noting that some concerns were raised here, so let's wait a bit for this one.

ntsekouras commented 2 years ago

I'm closing this for now due to the above concerns.