-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
All synced patterns are loaded in background - critical slow down of editor #64150
Comments
Same, I have synced patterns that utilize features from 3rd party plugins, for testing reasons. When the plugins are disabled the blocks produce validation errors. So when I go to any page, even where the synced pattern isn't being used, I get console full of errors. Pretty inconvenient during development to get messages about blocks that aren't on the page. |
yes, this is how I found that reusable template is reason of slow editor. I saw a lot of errors in console that have nothing related to blocks on current page |
These blocks initially come from a REST request I see. When I refresh the page, I'm seeing all my synced pattern blocks loaded from Subsequently they're coming from the store. I'd assume they're loaded so they appear in the sidebar: If so, here's the
With a value of It looks like there was some optimization in #58239, but I'm not sure it's related. cc @ellatrix or @jsnajdr if they have time to confirm. |
Hope there's a resolution to this bug soon |
I'd naively say that the request should take place only when the sidebar, or patterns tab, is opened. Having stated that, I'm not certain whether the editor needs to load the patterns immediately. Maybe there's another reason. But if not, then yes, it would be worth testing triggering the request later in my opinion. |
@ramonjd problem is not only in fetching. Now, all patterns are executed. Imagine you have 100 patterns. Now all your pages will have 100 loaded patterns in editor and executed. Of course it will slow down editor. And if you have dynamic data in patterns, page will be almost unusable. It should be top priority to fix this |
So, I expect the execution to link directly to the previews that rendered. As far as I can tell, the pattern previews are rendered as required. Here's mine logging to Kapture.2024-08-14.at.11.19.21.mp4I might be missing something here, but I can't any other pattern parsing when I load the editor. They're fetched via REST, as mentioned above. cc @kevin940726 who knows more about patterns than I ever will. On a side note, I'm wondering if pagination could help reduce the load on the browser when using the inserter? Pagination for previews has existed since: #54007 There's a static value for the number of items per panel gutenberg/packages/block-editor/src/components/inserter/hooks/use-patterns-paging.js Line 8 in 46f9fe0
Now, there's probably an argument to perhaps reduce this, or make it tweakable, for themes with very intensive patterns. |
@ramonjd did you try to console when you click on any block in editor? They are loading on first click on any block for me |
Yeah, I clicked all over the place in the editor, and the pattern was only rendered (and therefore the console.log executed) when I loaded the pattern preview in the inserter. Even when I added the pattern to the editor canvas. 🤔 Are there any other env vars you can add to the description? Or even a test pattern itself? Thanks! |
@ramonjd Ok, I made new test on clean site. And you are right, it's working as expected. Then, I switched to site where I had a problem. And .....it's also working as expected. Another mystery. But I see that there are several tickets with the same problem, so, problem exists. We just need to know condition when this happens. At least, I know that it's happening after specific condition and not always |
Should we close this until we can find the reproduction steps? I think it would be easier if one could reproduce it in a controlled environment like WordPress Playground! |
@kevin940726 @ramonjd This is reproducible with 3K+ reusable blocks. We created an issue for the same #64219. |
@sathyapulse Thank you for referencing the issue, I didn't catch up on that one! 🙇 I can reproduce the issue reported in #64219. To make communication easier, I think we can close this and move the conversation there. Feel free to reopen this if you don't think it's a duplicate! |
Thanks a lot @kevin940726 and @sathyapulse ! |
Description
Latest WP 6.6 and 6.6.1 have one strange problem. At first, I found that all posts that use synced patterns are loaded very slow. So, to test, I added console.log to all my blocks in plugin. And I was surprised to see that all my blocks from synced patterns (reusable templates) are loaded on all pages (even on those that don't use them in content).
Is it correct? Now all synced patterns are loaded everywhere in editor?
Step-by-step reproduction instructions
If site has dynamic blocks (like loop block) in synced patterns, this will make page almost impossible to use because all loops will be loaded at once.
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: