- Issue created by @nagy.balint
- Status changed to Needs work
over 1 year ago 11:52am 5 August 2023 - ๐ญ๐บHungary nagy.balint
Here is a quickfix for the problem.
Of course this will not make it work when facets are present on the view.
But it will fix normal views like the media library which normally has no facets but has to work with ajax most of the time.
- Open on Drupal.org โCore: 10.1.x + Environment: PHP 8.1 & MySQL 8last update
over 1 year ago Waiting for branch to pass - ๐ง๐ชBelgium herved
I'm facing the same issue.
I believe this especially shows on Drupal 10.1 as it now passes the page parameter directly (possibly from ๐ Allow AJAX to use GET requests Fixed ?)I would like to understand why that code in facets is there and find a proper fix but I cannot even get ajax facets to work at all...
The only ajax-related test in\Drupal\Tests\facets\FunctionalJavascript\AjaxBehaviorTest
doesn't seem to actually use ajax...
Things do not make any sense to me TBH...
PS: I created ๐ How to make AJAX work with facets 3? (issue with isRenderedInCurrentRequest) Active - ๐ง๐ชBelgium herved
I found an issue with patch #3 when accessing /views/ajax:
Warning: array_flip(): Can only flip string and integer values, entry skipped in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 278 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 262)
Drupal\Core\Entity\EntityStorageBase->load(NULL) (Line: 26)
Drupal\facets\Controller\FacetsViewsAjaxController->ajaxView(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)It needs to check if the
view_name
param is present. - ๐ฉ๐ชGermany Kevin Hoffmann Berlin
+1 for the patch
Also as a side note
facetsRemoveQueryParams()
contains
This only applies when the method is POST.
in its docstring. That being said its not even checking that condition itself and applies also for GET requests on my side. Aside from the fact that we remove keys from
$request->query
which afaik is related to GET requests to begin with. - ๐ง๐ชBelgium herved
@7 Indeed I also noticed this. This commit changed
$request->getMethod() === Request::METHOD_POST
to$request->isXmlHttpRequest()
. Perhaps it wasn't intentional ?
Again, I have no clue how AJAX facets are supposed to work since I can't make them work myself despite trying so I can't even debug or understand what this code is all about.In the mean time, here is a fix for #6.
- Open on Drupal.org โCore: 10.1.x + Environment: PHP 8.1 & MySQL 8last update
over 1 year ago Waiting for branch to pass - last update
over 1 year ago 420 pass, 2 fail - ๐ฌ๐งUnited Kingdom jefflogan
Thanks for the patch, this fixed my issue with the broken pager on ajax views.
+1 RTBC - last update
over 1 year ago 428 pass - last update
over 1 year ago 428 pass - last update
over 1 year ago 428 pass - ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
AJAX in facets 3.0.x is not yet finished. We waited for https://www.drupal.org/node/3193798 โ
And Drupal now uses a newer symfony version which changed the request parameter handling.
- Status changed to RTBC
over 1 year ago 4:33pm 16 October 2023 - ๐ท๐ดRomania claudiu.cristea Arad ๐ท๐ด
Tested and the error is fixed now.
- ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
Tested and the error is fixed now
Do you mean, that the code in 3.0.x dev works now since due to latest commits and that no further patch is needed. Or did you RTBC this patch here?
Did you test the patch with the latest dev version?
- ๐ท๐ดRomania claudiu.cristea Arad ๐ท๐ด
@mkalkbrenner,
We've applied the patch from #8 against 3.0.0-beta1 and that fixed the bug described in this issue (i.e. all ajax pagers are broken). I've RTBCed this patch because it fixes this issue.
- Status changed to Needs work
over 1 year ago 11:10am 17 October 2023 - ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
The issue description seems to redundant to ๐ Facets doesn't work correctly with views infinite scroll Active . That issue has been fixed and is already committed to the 3.0.x branch.
So I'm not sure if the patch proposed here is still required or if it needs adjustments due to the changes in 3.0.x-dev. So I won't commit it as it is. - ๐ง๐ชBelgium herved
Hello, thanks for the update.
For me it doesn't work, I tried both the latest 3.0.x (b71823b), and 3.0-beta1 + patch #8 from #3225764.
I'm on core 10.1.4, without views_ajax_get.It looks like views attempts to get the current page from
\Drupal\Core\Pager\PagerParameters::getPagerParameter
which retrieves it from$request->query->get('page', '');
while\Drupal\facets\Controller\FacetsViewsAjaxController::facetsRemoveQueryParams
removes the page param from $request->query. - ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
FacetsViewsAjaxController has been introduced by older versions of facets. I wonder if it should be removed entirely.
- ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
The code is about having and remove these GET parameters because Views AJAX based on POST. But nowadays Views AJAX bases on GET.
3.0.x already requires Drupal 10.1. So should not care about POST anymore. - ๐ณ๐ฑNetherlands undersound3
FYI
After upgrading from drupal 9.5.10 to 10.1.3 facet items were not showing up anymore in the Facet Summary block (not sure if related but writing down here for completeness sake).
I was then updating this module from 2.0.6 to 3.0.0-beta1 to see if it fixed that. It did. But then pagination in a "Media Browser Entity" browser did not work anymore. Applying this patch fixed that problem and now pagination works again.
- ๐ง๐ชBelgium StryKaizer Belgium
Attached patch will remove all leftover ajax stuff specific for facet blocks.
The way to go when you want facets + ajax is using the new better exposed filters way, see #3394955
- last update
over 1 year ago 425 pass - Status changed to Needs review
over 1 year ago 12:45pm 20 October 2023 - ๐ฉ๐ชGermany mkalkbrenner ๐ฉ๐ช
Does the commit of ๐ Facets doesn't work correctly with views infinite scroll Active be revised somehow?
- Status changed to RTBC
over 1 year ago 1:09pm 20 October 2023 -
mkalkbrenner โ
committed bd8f00ce on 3.0.x authored by
StryKaizer โ
Issue #3379445 by herved, StryKaizer, mkalkbrenner: Facets breaks all...
-
mkalkbrenner โ
committed bd8f00ce on 3.0.x authored by
StryKaizer โ
- Status changed to Fixed
over 1 year ago 2:08pm 20 October 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 5:24pm 14 November 2023 - ๐ง๐ทBrazil wfraga
@energee
I'm getting this error when applying 3379445-25.patch
Drupal core: 10.1.6
PHP: 8.1.2
Facets: 3.0.0-beta1Drupal\Component\Plugin\Exception\PluginNotFoundException: The "facets" plugin does not exist. Valid plugin IDs for Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetManager are: default, bef_links, bef_sliders, bef_datepicker, bef_single, bef_hidden, bef in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
- ๐ง๐ชBelgium bramvandenbulcke
Patch 3379445-25.patch is working fine for me.
@wfraga: is Facets 3.x enabled (installed) on your website?
- ๐จ๐ฆCanada Noregrebt
Patch 25 as well as dev release fixes the problem for me but breaks the actual facets.
- ๐จ๐ฆCanada Noregrebt
Resaving each facet has now fixed it. Thanks for the patch!
- ๐จ๐ฆCanada joseph.olstad
@mkalkbrenner , it would really help us all if you could please tag and release.
- ๐ง๐ชBelgium bramvandenbulcke
A follow up from my side: I used patch 3379445-25.patch and thought everything was working fine but the count of the pager wasn't working with the patch installed. For example: select a facet selection with a result of 3 pages and when selecting the next page the pager goes to 9 pages.
As a temporary fix I disabled AJAX on these facet views.
- ๐จ๐ฆCanada joseph.olstad
ok, thanks for the followup @bramvandenbulcke
I postponed :
๐ฑ Tag and release to fix - Facets breaks all AJAX views that uses pagers even without facets RTBC
Patch #25 and the pager, some remaining issue to work out. - ๐ซ๐ทFrance Soubi
With the patch #25 and views_infinite_scroll installed, I had to make my own url_processor plugin QueryString because the Request object used in the initializeActiveFilters function doesn't have any data to get the active filters when Ajax is enabled.
if ($this->request->isXmlHttpRequest()) { // $url_parameters = $this->request->request; $url_parameters = new InputBag($_GET); } else { $url_parameters = $this->request->query; }
$url_parameters was always empty.
I replace it with
if ($this->request->isXmlHttpRequest()) { $url_parameters = new InputBag($_GET); } else { $url_parameters = $this->request->query; }
in my custom url_processor plugin.
- ๐ต๐ฑPoland Graber
This is not released yet? Seriously?
No further comments. - ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Facets 3.0 is undergoing a major overhaul. What @StryKaizer is working on is not yet releasable.
- ๐ฎ๐ณIndia chakkche
+1 for #35.
Filters are not being respected with latest dev or patch from #25. I have to overwrite initializeActiveFilters in my custom url proccessor. i have made similar change mentioned in #35
I'm currently using version 3.0.0-beta1 and encountered an issue with broken AJAX pagination.
Applying Patch #25 resolved the problem.
Thank you for this patch!- ๐บ๐ธUnited States tyler.hastain Utah
I'm also currently using version 3.0.0-beta1 and was having the broken pagination issue when AJAX was turned on.
Applying Patch #25 resolved the problem for me as well. - ๐บ๐ธUnited States tyler.hastain Utah
We currently use version 3.0.0-beta1 and ran into the same AJAX pagination issue.
Applying Patch #25 resolved the problem for us as well. - ๐บ๐ฆUkraine paulrad
Here's the patch #25 with the Facets plugin still available for the Better Exposed Filters.
Version - 3.0.0-beta1 - ๐จ๐ฆCanada joseph.olstad
3.0.0-beta1 is far behind
I recommend someone tag 3.0.0-beta2 off of 3.0.x-dev
- ๐จ๐ฆCanada liquidcms
To fix facets break ajax paging (since upgrading core from 10.0 to 10.2); i upgraded Facets fro 3.0.0-beta1 to today's 3.0-dev.
Had to remove patch from here: ๐ Disable updating the facets after each facet selection for Apply/Reset facet buttons block. Needs work as it no longer applies. Dev release does fix the issue with ajax paging however i no longer have a Views facet plugin. All views which had facet filters now show broken/missing handler.
I'll try going back to -beta1 and just using latest patch from here.
- ๐จ๐ฆCanada liquidcms
Patch from #41 on -beta1 rather than latest -dev fixes pager as well as facet exposed filters. Still doesn't apply with ๐ Disable updating the facets after each facet selection for Apply/Reset facet buttons block. Needs work but i'll redo that patch.
- ๐บ๐ธUnited States jiong_ye
#41 works perfectly except it broke empty facet get hidden behavior.
- ๐บ๐ธUnited States akshayadimolam Albany
Patch #45 works for me on facets 3.0.0-beta1 on Drupal 10.3.6 & PHP 8.3. Pagination is working on all views.