I am working on a Drupal site on which a functionality breaks because the value of Drupal.settings.ajaxPageState.js gets reset to an empty array instead of an object containing the list of js files.

So I want to know what exactly is the use of this ajaxPageState object

1 Answer 1


The ajaxPageState object is used to collect already loaded theme assets (css, js files in Drupal 7, libraries in Drupal 8 and later) and pass that on to Drupal when doing AJAX requests, so that assets that have already been loaded are not loaded again. It also holds information about the theme currently in use, so that rendered results of AJAX requests can use the same theme.

See where it's used in Drupal 7:

And in the current Drupal 9:

Resetting ajaxPageState to an empty object or array will definitively have surprising effects on all features that rely on AJAX requests, as it basically means a lack of context for the theme logic on the server side.

  • I know, that's a bit late to help the original poster, but given that there doesn't seem to be another answer to this on Drupal Answers, I figured it's worth adding one.
    – berliner
    Nov 20, 2021 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.