[upstream] [11.3 behavior change] Infinite loop when rendering `PageRegion`s on Drupal 11.3
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3549574. -->
Reported by: [wotnak](https://www.drupal.org/user/3558113)
Related to !155
>>>
<h3 id="overview">Overview</h3>
<p>With the recently committed core change <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/drupal/issues/1237636" title="Status: Closed (fixed)">#1237636: Lazy load multiple entities at a time using fibers</a></span> that makes use of fibers in the EntityStorageBase, when using canvas page regions, the site hangs on load.</p>
<p>This is caused by how fibers are used in <a href="https://git.drupalcode.org/project/canvas/-/blob/f3bfb602d7c22e42bd011977b46730fcfceb8c86/src/Plugin/DisplayVariant/CanvasPageVariant.php#L166-182">CanvasPageVariant</a> when rendering the component tree of a canvas page region to allow for special handling of 'title' and 'messages' blocks.<br>
Before the core change, component tree rendering fiber was suspended only when processing those two blocks and resumed when executing special cases for those blocks. But now the fiber is also suspended when loading entities, for example components used in the page region, and the while loop that handles suspended fiber doesn't correctly handle the situation when the fiber is suspended in cases other than for those two special blocks.</p>
<p>It looks like originally LogicException was supposed to be thrown in such a case, but it is only returned in the match expression instead of being thrown.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Add support for handling fiber suspension during rendering of the component tree of page regions in cases other than for the two special blocks.</p>
<p>The easiest way to fix it would probably be to replace the default case in the match expression that currently returns a LogicException object with resuming the fiber instead. As far as I can see, it resolves the problem and doesn't affect any other functionality.</p>
<h3 id="ui-changes">User interface changes</h3>
<p>None.</p>
> Related issue: [Issue #3485917](https://www.drupal.org/node/3485917)
> Related issue: [Issue #3561392](https://www.drupal.org/node/3561392)
issue