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

Command icon 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:

Comments

mglaman created an issue. See original summary.

ankitv18 made their first commit to this issue’s fork.

deepakkm’s picture

Also keeping everyone in line that this should also be tested out with any module which runs ajax where optimize is running.

ankitv18 changed the visibility of the branch 3537922-barehtmlpagerenderer-calls-renderroot to hidden.

ankitv18’s picture

Proposed 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.

mglaman’s picture

This isn't just about autosave_form. There is a 500 error when rendering the page and the page causes a subrequest.

vipin.mittal18’s picture

Status: Active » Closed (duplicate)

The loop issue is addressed in https://www.drupal.org/project/acquia_optimize/issues/3525986. Upgrading to version 1.2.2 resolves the problem.