Problem/Motivation
The AJAX request /facets-block-ajax returns add_js command to inject already loaded Javascript files due to the new request created and push to request stack in FacetBlockAjaxController.
The AjaxResponseAttachmentsProcessor in buildAttachmentsCommands have $ajax_page_state = $request->get('ajax_page_state'); to NULL value, and means the code below does not set properly the already loaded library :
$assets->setLibraries($attachments['library'] ?? [])
->setAlreadyLoadedLibraries(isset($ajax_page_state['libraries']) ? explode(',', $ajax_page_state['libraries']) : [])
->setSettings($attachments['drupalSettings'] ?? []);
Steps to reproduce
Proposed resolution
Inject if exists the ajax_page_state to the new request :
// Add ajax_page_state to the new request if set.
if ($request->request->has('ajax_page_state')) {
$new_request->request->set('ajax_page_state', $request->request->all('ajax_page_state'));
}
elseif ($request->query->has('ajax_page_state')) {
$new_request->query->set('ajax_page_state', $request->query->all('ajax_page_state'));
}
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #3
elc commentedAdding customised patch for adding after #3052574-254: Facets with AJAX not working in most of situations.
This is the only way to get my facets working with D10.3 again.
Comment #4
joao.ramos.costa commentedWorks smoothly,
Tkx @elc.
+1
Comment #5
renrhaf+1
Comment #6
p-neyens commented+1
Comment #7
talisa1987 commented#3 Works for me. Thank you!
Comment #8
sivaji_ganesh_jojodae commentedLooking forward to the release.