-
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
Synced Patterns: Ensure recursion prevention is working correctly #56455
Comments
Thanks for the issue and the debugging, @annezazu and @talldan! Without detailed instructions to reproduce this bug, this will be difficult to fully diagnose. That said, in thinking about how runaway recursion can occur, it struck me that the thin gutenberg/packages/block-library/src/pattern/edit.js Lines 77 to 81 in a7d76c3
gutenberg/packages/block-library/src/pattern/index.php Lines 50 to 52 in a7d76c3
Now with the consolidation of terminology around "patterns" — synced or not synced — this has become easier to miss: synced patterns (formerly "reusable blocks") are protected, unsynced aren't. I can confirm that one can create recursive dynamic patterns that crash both the front end and the editor, and I'll be sharing a fix soon. Due to the idiosyncratic mechanics of this block, the standard approach based on That said, the original report is odd in that only the front end crashes, but the editor correctly caught the recursion. I wonder if this could be the result of a strange mutual recursion, e.g. an unsynced pattern references a synced pattern which references the unsynced pattern back. This is pure conjecture, and perhaps a red herring. |
I'll do what I can to reach out to the original X poster and see if we can get more info :) |
Nice debugging @mcsf |
A report on X was brought to my attention where someone placed a reusable block (synced pattern) within itself causing a 500 error. This is reminiscent of a previously reported and handled problem described here #18704. As a result of that prior issue, a RecursionProvider component was created as well as simple conventions for preventing recursion on the front end. As noted previously, this was originally implemented in #28405, #28456, #31455. It seems there might be something off with the server warning based on the post on X so this is an issue to follow up to ensure things are working correctly. cc @mcsf who helped implement this work previously!
The text was updated successfully, but these errors were encountered: