metafizzy / infinite-scroll

📜 Automatically add next page
https://infinite-scroll.com
7.41k stars 1.74k forks source link

Infinite Scroll altering request URL #915

Open rctneil opened 4 years ago

rctneil commented 4 years ago

Hey,

I have a very strange issue with Infinite Scroll. Well, I THINK it is Infinite Scroll. I honestly can't see what else is causing it.

Go here: https://dev.neiltonge.co.uk/parks/coasters?sort=order If you choose “2019” from the “All years” select box about halfway down, then scroll to the bottom of the grid and click “View more coasters”. That works fine. If you scroll back up and check the checkbox next to “New in 2019” and now try to “View more coasters”. You’ll see it says there are no more to load, even though the pagination above the grid says otherwise. It took me a while to figure out what was happening but if you check the network inspector whilst clicking the button with the select box and checkbox set, you’ll see that the URL it’s requesting from is all good apart from it’s changed the “ridden_in” parameter from “2019” to “219”. Therefore no results. This is really confusing because the pagination "next" link works fine. I’m completely baffled by this one.

Thanks

evalenzuela commented 3 years ago

How did you solve it?

rctneil commented 3 years ago

How did you solve it?

Unfortunatley I haven't solved it. Still not sure what the issue is. Do you know?

evalenzuela commented 3 years ago

Not yet, I will let you know.

desandro commented 3 years ago

Thanks for reporting this issue. Do I need to take another look at this? From what I saw the site seems to be loading all the 2019 coasters

rctneil commented 3 years ago

Thanks for reporting this issue. Do I need to take another look at this? From what I saw the site seems to be loading all the 2019 coasters

Hi @desandro

Unfortunately this is still not working correctly. The issue is to do with the "New in 2019" checkbox that appears AFTER you choose "2019" from the "All Years" dropdown.

On page load, if you choose "2019" from the "All Years" dropdown, there should be 168 entries. If you then check the "New in 2019" checkbox, there should now be 122 entries. At this point If you use the "View more Coasters" but underneath the grid, it will return the "No more Coasters" text string. But only 25 are visible and 122 are available. If you look at the URL, the reason for this appears to be that something has removed the "0" from "2019"!

Take a look at my screenshot to see the changed URL:

Screenshot 2020-12-06 at 07 56 24

I've just been looking more at this myself. The "Next" link URL in the Pagination links is perfect and that is the URL I am pointing InfiniteScroll at for the button load. But pressing the button to load more coasters causes it to remove the "0" in the "ridden_in" URL parameter and therefore causes it to not load any more. I'm unsure if this is an InfiniteScroll bug or just a bug in my app.

One other point, Infinite Scroll appears to work fine for everything else regarding that grid display, It only seems to display this issue if that specific checkbox is checked. That checkbox adds this query parameter: "new_in_riy=1", but it's the "ridden_in" parameter that gets modified in such a way as "2019" => "219" as an example.

If you could take a look and hopefully give me a pointer i'd appreciate it sooooo very much!

I hope I've explained it clearly. It's a very strange issue. I really appreciate you taking a look.

desandro commented 3 years ago

Ah, okay.

I think the problem is with Infinite Scroll. The regex that Infinite Scroll uses is not matching the page=2 in ?page=2&ridden_in=2019&sort=order so its falling back to the last number in the URL, which happens to be 019, as it looks for up-to-three digits.

I'll look into fixing this.


For my own development. the Regex should match /parks/coasters?page=2&ridden_in=2019&sort=order or /parks/coasters?ridden_in=2019&sort=order&page=2

rctneil commented 3 years ago

@desandro Thanks for the update! Very relieved the source of the bug has been found. Been wondering where it was hiding for ages. I hated coming here and posting about it when I wasn't 100% it was Infinite Scroll causing it.

I very much look forward to the fix! Will you post here when an update is available?

Thanks again!

rctneil commented 3 years ago

@desandro Hi, I've just updated to 4.0.1 and the issue is still persisting. The way to recreate it is identical as to the above posts.

Thanks in advance, Neil

rctneil commented 2 years ago

@desandro This is still causing an issue. Would you be able to take a look and hopefully put in a fix for it? Thankyou!!

rctneil commented 2 years ago

Hi @desandro

There still appears to be a bug in here regarding this. Please please please could you take a look into it. Very happy to Paypal you a couple of beers if this is possible to fix! :-)

Pixelous commented 2 years ago

Hi,

The same is not working for me(

Pixelous commented 2 years ago

I am sorry, it actually working, looks need to use

updateGetPath

https://github.com/metafizzy/infinite-scroll/issues/936#issuecomment-761265218

rctneil commented 2 years ago

Hi @desandro Is there an update on this? It is still causing a big issue in my app.

I see @PeterTakahashi has a pull request that he mentions will fix this. Could this be reviewed and merged? If not, how do I use those adjustments on my installation?