this post was submitted on 19 Sep 2023
64 points (92.1% liked)

No Stupid Questions

35696 readers
1543 users here now

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here.



Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

founded 1 year ago
MODERATORS
 

When scrolling through Lemmy, I often will see the same posts from the previous page - usually as the first links on the current page I'm on.

all 19 comments
sorted by: hot top controversial new old
[–] FartsWithAnAccent 44 points 1 year ago

Just speculating but, as new posts are made, it pushes the other posts up some, which can make them show up again when you hit next (or hit the infinite scrolling reload point).

[–] [email protected] 18 points 1 year ago* (last edited 1 year ago) (2 children)

Lazy programming.

The naive way to do pagination is to say show me items x through y. But obviously if the back end is dynamic, x through y could change. So the better way to program pagination is to say show me items above item n, too item n plus x, where n is a specific post rather than an index. Then you can have dynamic pagination based on the last comment, you saw.

Another way to do this is have your session look at a static snapshot of the dynamic database, until you refresh the page or go back to the top. This is possible with a lot of different databases, kind of like how ZFS can give you snapshots of root at any time.

[–] devious 18 points 1 year ago (1 children)

I don't know if it is lazy as much as it is a design choice - remember at one point Lemmy actually auto updated (which meant posts were pushed down while you were browsing) and it was an intentional design.

https://github.com/LemmyNet/lemmy/issues/2841#issuecomment-1535469357

[–] [email protected] 8 points 1 year ago (2 children)

It's a valid design choice. But it is to keep the programming simple. One might characterize that kind of choice as lazy. Especially in terms of user interface. But I'm not beating up on Lemmy. I'm just explaining to the original poster the trade-offs that people make.

[–] [email protected] 9 points 1 year ago

one man's lazy is another man's efficient and pragmatic

[–] Thehalfjew 3 points 1 year ago (1 children)

It's not necessarily lazy. If I want to go back to a particular post I saw on page 1 when I'm on page 2, but it was knocked off the front page, how would I find it? It's no longer on page 1, so back would miss it. I'd have to go to 1 and then back again to 2 to find a post that moved.

It gets even more complicated when the algorithm also changes post order.

Sometimes simple with minor inconvenience is the best option.

[–] [email protected] 1 points 1 year ago

In an endlessly scrolling implementation, you’d just scroll up.

Without endless scrolling, it could behave as follows:

  1. Moving back to page 1 takes the user to where they were on page 1 when they navigated away, with the same items visible
  2. When automatically fetching new posts, either expand the page (pushing nothing off) or make it visually clear that pages will be pushed to the next page. Or just don’t fetch new posts automatically, and only reset the first / last post of a page if the user clicks Refresh.
[–] [email protected] 6 points 1 year ago (2 children)

“Let’s have each user take an individual snapshot of the database to scroll over until they refresh like in ZFS” ok buddy

Tell me you’ve dabbled in homelab stuff without telling me you’ve never designed a high traffic web backend

[–] [email protected] 11 points 1 year ago* (last edited 1 year ago)

Sir, you hardly know me! Disagree fine, but don't assume my pedigree.

FWIW temporal tables, and time travel are real things available now and they are built very similarly to ZFS versioning.

If we are truly trying to make a highly scalable distributed website, we wouldn't be querying a database directly, would be using something distributed. Like foundationDB, or memcached. And we would have to modify our approach somewhat, but these are still solvable problems. The architecture and the requirements are tightly coupled. But we can't make assumptions and rule out solutions at the whiteboard stage.

[–] [email protected] 2 points 1 year ago (1 children)

Why do you have to be so condescending from the get-go? Just explaining why it wouldn't work would have been fine.

[–] False 1 points 1 year ago* (last edited 1 year ago) (1 children)

To be fair it's in response to a guy that started off by calling the programmers lazy.

[–] [email protected] -1 points 1 year ago

That explains, but doesn't excuse.

[–] [email protected] 6 points 1 year ago

I think when a new post is posted and it hits the front page it bumps all the other posts back by that many, which will make them get bumped from the end of one page into the beginning of the next

[–] [email protected] 2 points 1 year ago

You have your answer from every commenter here but this is why it’s best to browse with an app that marks as read and hides stuff as you scroll.

[–] [email protected] 2 points 1 year ago (1 children)

Because new content got posted while you were browsing trough the page. If you refresh the page you're on it shows different entries on the top and the bottom ones are pushed to 2nd page.

[–] [email protected] 1 points 1 year ago

when you start seeing the same posts again and again the deeper you go, that's your cue to start back on page 1 again.

[–] uservoid1 2 points 1 year ago

New posts added since your last refresh push some of current page posts to the next one

[–] [email protected] 1 points 1 year ago

The easiest solution might be to just look at what is returned and see if there are any duplicates with what you already have, and just filter those out. It’s not like you’re going to notice if the returned list is shorter if it loads more before you even get to the bottom.

If you get less than 1 screen of posts, ask for more.