Problem/Motivation
BareHtmlPageRenderer calls renderRoot and can lead to the scan going endlessly. Instead we need to render the node in isolation.
Steps to reproduce
Proposed resolution
$html_build = [
'#type' => 'html',
'#attributes' => [],
'page' => [
'#type' => 'page',
'#theme' => 'page',
'#title' => '',
'content' => $build,
],
];
$html = $renderer->renderInIsolation($html_build);
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork acquia_optimize-3537922
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3537922-barehtmlpagerenderer-calls-renderroot
changes, plain diff MR !21
Comments
Comment #4
deepakkm commentedAlso keeping everyone in line that this should also be tested out with any module which runs ajax where optimize is running.
Comment #6
ankitv18 commentedProposed solution isn't fixing the actual cause, also Ajax call still conflicted with a autosave_form.
And please note if I replace with the proposed solution then META description, sub-headings and Title are missing from SEO checks.
The bare_html_page_renderer service renders a complete HTML page without the normal Drupal page structure (no admin toolbar, no blocks, no theme regions - just the raw content). elements, meta tags, etc. automatically included
Whereas renderInIsolation renders just the content without full page structure and other SEO required elements will be missed like META tags, Title and other HEAD elements.
Comment #7
mglamanThis isn't just about autosave_form. There is a 500 error when rendering the page and the page causes a subrequest.
Comment #8
vipin.mittal18The loop issue is addressed in https://www.drupal.org/project/acquia_optimize/issues/3525986. Upgrading to version 1.2.2 resolves the problem.