I'm having an AJAX form, which on submit fires a callback function where I want to attach my library.
Here's the submit button:
$form['actions']['submit'] = [ '#type' => 'submit', '#value' => 'Submit', '#button_type' => 'primary', '#name' => 'calculate', '#submit' => ['::submitForm'], '#ajax' => [ 'callback' => [$this, 'submitFormCallback'], 'wrapper' => 'my-form-id', ], ];
When the submitFormCallback is called I attach my library using AjaxResponse and its addAttachments like this:
$ajax_response->addAttachments([ 'library' => ['my_module/library_name'] ]);
Is there any problem with the way I attach the library to AjaxResponse that may cause the broken layout?