Menu

Continuous Scrolling for Long Build Logs Without Breaking /page/N
📰

Continuous Scrolling for Long Build Logs Without Breaking /page/N

DEV Community: laravel·Matt·3 days ago
#BlBOSIeC
#devtolaravel#devto#dev#entry#entries
Long article (1807 words) — no AI summary yet.
Reading 0:00
15s threshold

I run Boat Build Log , a free site where amateur boat builders keep a log of their build. A log is a list of dated entries, each with a paragraph or two and up to a couple dozen photos. Some builds take two years, so some logs get long.

A reader wrote in about a fourteen-entry log. He didn't like having to find and press "Later entries" at the foot of every page. He wanted the next page to just show up as he scrolled. Fair request, and it sounds like an afternoon of work. It mostly was. Then I shipped two bugs with it, and I'll walk through both.

Why the log is paged in the first place

The log page used to load every entry with all its media and comments in one response. That was fine at eleven entries. It wasn't fine for a Glen-L Squirt log, which was a two-year build with every photo coming down the wire as a single page. So the controller pages it, five entries at a time:

public const ENTRIES_PER_PAGE = 5 ;

Enter fullscreen mode

Exit fullscreen mode

Five is a reading unit, not a performance number.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.