Currently Drupal make ajax request via post method so checking q query parameter not working.
So that requires additional check on PrettyPathsActiveFilters.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | facets_pretty_paths-fpp_lost_path_context_on_ajax_req-3129632-22.patch | 916 bytes | rossb89 |
| #18 | 3129632-18.patch | 678 bytes | colorfield |
| #5 | interdiff_2-5.txt | 627 bytes | colorfield |
| #5 | 3129632-5.patch | 752 bytes | colorfield |
| #2 | 3129632-2.patch | 668 bytes | voleger |
Comments
Comment #2
volegerHere the patch.
Comment #3
alex_optimWork for me.
Comment #4
kachinsky commented#2 didn’t work for me.
In my ajax view after applying the filter, if I click on the next page, instead of the next filtered page, I see the view without filtering.
I've debugged it a little and found out that q is NULL for url like "?q=/en/products/category/buckets-802&sort_by=created&page=1", from request object I can only get page and sort_by parameters.
Comment #5
colorfieldI can reproduce #4, it seems that
$_REQUEST['view_path']applies to the originally accessed url.So if /my-view or /my-view/filter-1 is accessed, it will set this path even after a facet change (e.g. /my-view/filter-2).
If we follow the same principle, we could workaround this by making use of the referer, not sure if this is valid approach though.
I've tested with other query string parameters like full text search or pagination it seems to be fine.
Comment #6
kachinsky commentedI tried patch #5 and I can confirm that it solves the problem.
Thanks @colorfield
Comment #7
spuky commentedPatch #5 is also working for me... Thanks
Comment #8
rgeerolfPatch #5 is also working for me.
Comment #9
DonAtt commented#5 works for me together with the Facets 2.0.x AJAX fix: https://www.drupal.org/project/facets/issues/3052574#comment-15050142
Comment #10
DonAtt commentedComment #12
joseph.olstadComment #14
szeidler commentedWith Drupal 10.1 views is using GET AJAX requests by default, when AJAX is enabled.
In my case we're using
views_infinite_scrolland the path context is lost, because of the POST limitation in this commit. I think we would need to make it work with GET requests as well now.Comment #15
joseph.olstad@szeider, if you could kindly share a solution to this, I'll review it.
Comment #16
joseph.olstadD10.1-only issue?
Comment #17
szeidler commentedYes, the problem is tied to Drupal 10.1 where the support for AJAX GET requests has been introduced and made the default for example pagination.
It's essentially about this line.
I don't know why the limitation to the method was made, but in my test case changing it to the following resolved the issue
Comment #18
colorfieldThanks @szeidler for mentioning the core changelog and the fix, works for me too. I don't think that removing POST limitation would cause any issue. Here is a patch, it should also apply to 2.0.x branch https://git.drupalcode.org/project/facets_pretty_paths/-/blob/2.0.x/src/...
Comment #19
colorfieldComment #20
dan2k3k4 commentedRemoving the `$this->request->isMethod('POST')` check seems like the best approach. We could have checked if `POST or GET request` but I don't see any reason for such limitation.
Tested on one client project and working as expected.
Comment #21
joseph.olstadThis seems like an important fix.
Would someone be willing to wrap this new condition in a version check?
Comment #22
rossb89 commentedRe done the patch with the additional logic check requested above :)
Comment #24
joseph.olstad