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.
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
whenlist
was used. I think we should do this for GB and coreQuery
patterns as well.