simple ajax-form inside block reacts very slow

Created on 21 May 2017, over 7 years ago
Updated 22 April 2023, over 1 year ago

I have a very simple ajax-form containg this:

$form['submit'] = array(
      '#type'  => 'submit',
      '#value' => 'Teilen',
      '#ajax'  => array(
        'callback' => '::ajaxShareButton',
        'wrapper'  => $ajax_id,
      )
    );

I made routing for this form - behaviour is like expected: clicking on submit alters the form in 0.5 seconds.

Now I put this form in a simple block (via getForm):

 public function build() {
    $form = \Drupal::formBuilder()->getForm('Drupal\zag_base\Form\ShareContent');
    return $form;
}

The form renders in the block, but clicking on submit alters the form now in about 3 seconds !

After some debugging I traced that eventually the whole page was rendered internally - It stops at a breakpoint in \Drupal\Core\Render\MainContent\HtmlRenderer::prepare

In both cases the ajax-call is the same:
http://d8/myajax?ajax_form=1&_wrapper_format=drupal_ajax

any Idea ?

πŸ› Bug report
Status

Closed: duplicate

Version

9.5

Component
AjaxΒ  β†’

Last updated 1 day ago

Created by

πŸ‡©πŸ‡ͺGermany kle

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    @kle, Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.

    An explanation if given in #5 and a link to another issue solving the same problem. That one has since been closed as a duplicate, in favor of 3 other issues which are resolving this. I had added those issues as related issues here.

    closing as a duplicate.

Production build 0.71.5 2024