I add a view with two exposed filters in a page through the preprocess of this page. When I load my page the first ajax request I do on my view works fine but the next one crash the javascript.
In summary here's what I do in my preprocess :
$refView = Views::getView('ref');
$refView->initDisplay();
$refView->preExecute($args);
$refView->execute();
$renderedView = $refView->render();
On the client side, the error occurs in core/misc/ajax.js
when the settings()
function try to clean-up the expired settings of the drupalSettings.ajax
object:
invalid 'in' operand ajaxSettings
drupalSettings.ajax
appears to be null
because the "drupal-settings-json" JSON of my page doesn't contain an ajax
object after my first AJAX request --but does when I initially load my page.
Did I do something wrong with my view or is this a bug?
Either way, wouldn't it be more cautious to set the ajaxSettings variable this way in ajax.js
' settings()
function:
var ajaxSettings = drupalSettings.ajax || {};
Comments
Comment #2
droplet CreditAttribution: droplet commentedhave you tested with GIT HEAD ?
#2700495: Method removing expired drupalSettings.ajax tries to remove settings when there is no ajax defined
Comment #3
yvesmarie CreditAttribution: yvesmarie at Studio.gd commentedI currently can't update my project from GIT HEAD but the patches proposed in issue #2700495: Method removing expired drupalSettings.ajax tries to remove settings when there is no ajax defined are similar to my fix and solve the problem. Thanks!
Comment #4
droplet CreditAttribution: droplet commented