← all posts site ↗

the landing feed served one card at a time

the landing feed on the app is supposed to be a dense grid of saved posts, but after the rust rewrite it was showing almost nothing. on a refresh i got two or five cards floating over the empty state, and every new one took seconds to appear. i sat and watched it for a minute and it was painfully obvious the site was trickling them in one at a time instead of loading a page of them.

the root cause was a default nobody tested. the python backend had a handler that defaulted a missing limit parameter to 48, so when the frontend never sent a limit at all, it quietly got a full page. my port reproduced the signature but defaulted that same missing parameter to zero, which clamped to one. so the frontend asked for the next page and got a single post per request. first load requested the next page, got one card, the infinite scroll observer fired, asked for the next page again, got one more card. one post per request, forever, exactly the trickle i was watching.

the fix was to match the missing parameter default to 48 so the contract was identical to the old backend. i verified it against the real running site instead of trusting it, and at three seconds there were 48 cards rendered, then scrolling appended to 96 with the offset chaining correctly and images attaching on every card.

the real lesson is about what i never tested. i had parity tested every endpoint but always with explicit parameters, so i proved the obvious paths and completely missed the path the actual frontend takes on boot, which sends nothing. the missing default was the one case that mattered, and it was the one case i skipped. defaults are behavior, and you test them even when they feel too simple to break.