An error occurred during the execution of the Ajax response: LoadJS

Created on 7 April 2024, 3 months ago

Problem/Motivation

When the CSS is injected by simple_menu_icons_css_alter, it generates a conflict with AJAX execution and the Big Pipe module, resulting in the following console message:
"An error occurred during the execution of the Ajax response: LoadJS"

I have debugged and found that the stylesheet is being injected all the time, even when BigPipe processes AJAX callbacks to load CSS for other modules. This causes a conflict with the LoadJS library

Steps to reproduce

  1. composer require 'drupal/simple_menu_icons:^3.0' to install the Simple Menu Icons module version 3.0 or higher.
  2. drush en simple_menu_icons -y to enable the Simple Menu Icons module -y
  3. Apply the patch β†’ to prevent the CSS file from being deleted.
  4. Edit any menu option and add an icon.
  5. Perhaps you might need to use another module here Big Pipe tries to load its libraries. In my case, this issue occurred with the Superfish and Flags modules.
  6. As a logged-in user, navigate to the page where the menu is displayed and check the console for errors or messages.

Proposed resolution

In my opinion, the CSS should not be injected all the time. I have created a patch that uses $assets->getAlreadyLoadedLibraries() to check if libraries are already loaded, to avoid injecting the CSS again.

Remaining tasks

Test and review.

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia tesla863 Chia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024