Skip to content

msglist: Open near first unread #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

rajveermalviya
Copy link
Member

@rajveermalviya rajveermalviya commented Dec 18, 2024

Fixes: #80

@gnprice
Copy link
Member

gnprice commented Jan 24, 2025

Thanks @rajveermalviya for building this!

For getting the sticky headers working properly in this new more-complicated setting, I have a draft branch from… oof, a year ago, it looks like. (I think things got hectic with the start of GSoC season, and I let it slip off my queue and never picked it back up again until now.) I just rebased that and did some quick manual testing, and I think it basically solves that problem. I'll spend some time fleshing that out, adding tests, and refreshing myself on exactly what it does and doesn't do.

That draft branch doesn't do anything to MessageListView — it just sticks the latest 10 messages into the bottom sliver, as a way of making things interesting enough to exercise the sticky headers. I think we could merge that once I've polished it up, but it won't have any user-visible effect by itself; it just lays part of the foundation.


Meanwhile I tried out this branch in some manual experimentation, and it seems like it basically works great except for the sticky headers. (In fact if I revert the bits here that cut out the sticky headers, those work great too… except in the screenful immediately above the sliver boundary.) So that's encouraging! I think this basically supplies what we need in the view-model, MessageListView.

I did spot one bug: after some rapid scrolling around back and forth, both up and down, I found myself at the bottom of the list when there was definitely later history still to be found and it wasn't updating. The log looked like this:

…
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1981484&include_anchor=false&num_before=20&num_after=0
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982282&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982316&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982399&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982525&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982778&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982836&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1982905&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983028&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983197&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983324&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983385&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983419&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983449&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983565&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983603&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983671&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983671&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983671&include_anchor=true&num_before=0&num_after=20
flutter: GET https://chat.zulip.org/api/v1/messages?narrow=%5B%5D&anchor=1983671&include_anchor=true&num_before=0&num_after=20
[… then dozens more lines just like those last few …]

So that seems like a bug in perhaps the backoff logic — we sent way too many requests, got rate-limited, and perhaps kept sending lots of requests after that. I looked at the code and compared fetchNewer to the existing fetchOlder, though, and it sure seemed like the backoff logic worked the same way. Not sure if I managed to trigger an existing bug that's already there in our fetchOlder backoff, or if there was a subtle difference I missed, or something else.

(In case it helps with reproducing: I did that running it as a desktop Linux app, using the scroll wheel to scroll.)

Anyway, if you feel like taking a break from the TeX work on another task, you might investigate and see if you can diagnose and resolve that behavior. You can leave the slivers just as they are in this revision, to give a scaffolding for experimenting with the view-model, and assume that the slivers part will be replaced later with the branch I'm working on.

@rajveermalviya rajveermalviya force-pushed the pr-open-near-unread branch 2 times, most recently from 932ffbc to d45d8b3 Compare January 26, 2025 21:40
@gnprice
Copy link
Member

gnprice commented May 20, 2025

Closing this in favor of #1517. Thanks @rajveermalviya for the experiment.

@gnprice gnprice closed this May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open message list at first unread, rather than latest message
2 participants