The Needs Review Queue Bot → tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- 🇺🇦Ukraine lobodacyril
I'm not sure that's possible to solve without changing JS code since each AJAX request is sent using URL. Look at the JS code, it takes window.location.search and sends all the URL query parameters via AJAX. It means if the query contains page parameter, it will be sent also. That's why we need to remove sending page param.
- 🇺🇦Ukraine lobodacyril
The patch stopped working so I changed and it works on 9.5.3
- 🇳🇱Netherlands Lendude Amsterdam
Well, at least it doesn't break any existing test, that's positive.
We do need test coverage for this bug though, so setting back to needs work for that.
- last update
about 1 year ago 29,672 pass - First commit to issue fork.
I'm not sure this or the original behaviour works as expected when the query parameter is not the first entry, or the first query ends with a
q
orrender
.I've provided some example test cases to showcase the behaviour here: https://playcode.io/1830989
const queryStrings = [ 'q=/path', 'faq=should_not_be_affected', 'myrender=should_also_not_be_affected', 'q=/path&a=1&q=/second-path', 'q=/path&render=value', 'q=/path1&q=/path1&faq=true&dont_render=1&q=/path&render=render_value&page=1&final_value=1', ]; for (const queryString of queryStrings) { const output = []; output.push(queryString.replace(/q=[^&]+&?|&?render=[^&]+/, '')); output.push(queryString.replace(/q=[^&]+&?|page=[^&]+&?|&?render=[^&]+/, '')); output.push(queryString.replace(/(^|&)(q|render|page)=[^&]+/g, '').replace(/^&/, '')) console.log(output); }
This might be potentially supeceded by 🐛 Query string is appended multiple time after each AJAX request Needs work which now attempts to use a
URLSearchParams
object to remove those same values. But we may also look into using the updated regex provided instead, and leave that as a follow-up.I also believe the
render
query parameter might be legacy code and no longer relevant in D9+, so can probably be removed since I can't find any references to it in core.- Status changed to Needs review
7 months ago 10:29am 14 April 2024 - First commit to issue fork.
- Status changed to RTBC
7 months ago 3:31pm 15 April 2024 - 🇺🇸United States smustgrave
Appears tests have been added
Added a nitpicky missing void return.
Verified the issue following the steps and that the MR addresses the issue.
Hiding unused MR.
- 🇮🇳India Pravesh_Poonia
@smustgrave, Applied mr changes are looking good to me, @
lobodakyrylon you can check it is good to go - Status changed to Needs work
7 months ago 8:11am 16 April 2024 - 🇳🇿New Zealand quietone
Sorry folks, but this does need a title that better describes what is being fixed and be in proper English.
I think the points raised in #15 regarding the regex only working if the paramter is the first entry are still relevant.
- Status changed to Needs review
7 months ago 9:23am 16 April 2024 - 🇺🇸United States smustgrave
@codebymikey do you want to open an MR to try your idea of removing.
- Status changed to Needs work
7 months ago 2:15pm 25 April 2024 - 🇺🇸United States smustgrave
Think maybe we should have test coverage for the points in #15.
- First commit to issue fork.
- Merge request !9355Issue #3323574: Fixing regex using the one supplied be codebymikey. → (Open) created by the_g_bomb
- 🇬🇧United Kingdom the_g_bomb
As mentioned in the MR.
I have opened an MR using the latest changes introduced by smustgrave in #21, but with the alternate regex supplied by codebymikey in #15.I have yet not added the test coverage as requested in #27.
- First commit to issue fork.
- 🇮🇳India vinmayiswamy
Hi, I updated the test to cover scenarios with multiple query parameters in the request, specifically adding extra parameters like
foo
andq
alongside the page parameter. This change ensures that pagination resets correctly when there are additional parameters in the URL, which is common in real-world cases.Hi, I updated the test to simulate scenarios where multiple query parameters are involved in the request. Specifically, I added test cases that include extra parameters like
foo
andq
alongside the page parameter. This was necessary because, in real-world scenarios, URLs often contain additional parameters, and I wanted to ensure that the pagination reset behaves correctly even with these variations.I started by filtering content by title and confirming the correct result. Then, I tested the page with both
foo
andpage
parameters, applying the filter again to check that the additional parameters didn’t affect the pagination. Lastly, I included a case where bothq
andpage
parameters appear in different positions, ensuring the pagination resets as expected.These updates help cover edge cases with query parameters, preventing issues with pagination and ensuring that the filtered content is returned correctly.
Additionally, I verified the fix in Drupal 11.x fresh install and attached before and after screenshots for reference.
Kindly review the changes and please let me know if any further adjustments are needed. Your feedback and suggestions for improvements are greatly appreciated.
Thanks!
- 🇺🇸United States smustgrave
Before moving to review please make sure pipeline is passing and tags addressed.
Need to reconfirm whether this is still an issue in >= 10.3x since the merging of 🐛 Media Library widget display doesn't return to first page on applying filters Needs work