Pagination is broken in timelines
Site
phanpy.social, and when running locally in dev mode
Version
2025.03.22.85d964f, and on latest main branch
Instance
enby.life
Browser
- Firefox 136.0.2 on Windows 11
- Edge 134.0.3124.83 on Windows 11
Bug description
Timeline pagination does not work - Phanpy always stops with "The end." and refuses to scroll further. Testing with a debugger shows that the API response includes pagination headers and Phanpy understands them correctly, resulting in a call to setShowMore(true). This would enable pagination, but for some reason the loadItems callback is immediately fired a second time, hitting the else condition which includes setShowMore(false). Thus, the flag is reset to false and the timeline does not scroll. I'm not exactly sure why this is happening, but it seems like maybe useDebouncedCallback isn't working correctly?
To reproduce
- Go to the Home or Federated timeline. Others may work, but these are the two I tested most closely.
- Scroll down. The timeline will stop after one page and disable "The end.", despite the presence of more posts and correct pagination headers from the server API.
Expected behavior
The timeline should have continued to the next page of posts.
Other
I've been testing with a Sharkey instance, which uses an API translation layer for Mastodon support. This could (and does) cause some bugs, but I can't see how it would cause this particular bug. The pagination behavior matches mastodon and I've personally verified the API responses coming from the server.
I guess that it is not Phanpy problem. On phone I'm using Moshidon client with pretty much same situation, that earlier post is not loading.
Huh, it's interesting that Moshidon is affected too. I can't reproduce the problem with Elk despite them making identical requests AFAICT. Do you know of any other clients I could check?
Tokodon (not loading older posts), Raccoon (loading fine) Tuba and Masto-FE is not supporting Sharkey,
Ah, I believe it's caused by this: https://stackoverflow.com/a/54928828. Sharkey doesn't set the access-control-expose-headers header so the web browser strips all response headers. I verified with a debugger that the returned headers object is empty. So this isn't really a bug in Phanpy, although it may be worth supporting the non-header pagination mode as well. (This is why Elk and Raccoon work correctly.)
I'll fix this in Sharkey for the next release.
This is why Elk and Raccoon work correctly.
I dunno, but I can't login into Elk via Sharkey 🤷 https://github.com/elk-zone/elk/issues/2595
I dunno, but I can't login into Elk via Sharkey 🤷 elk-zone/elk#2595
It may require some of the other changes that I haven't published yet. (I've got about 20 commits with improvements to Sharkey's mastodon API sitting in a branch waiting to be published.) I'm able to log into enby.life and use nearly all features of the app, with relatively few bugs.