RORK LABJP
MAX — Rork Max generates native Swift for every Apple platform, from iPhone to Vision ProPUBLISH — Publish to the App Store in two clicks without Xcode, reaching iOS distribution without Mac hardwareNATIVE — Standard Rork builds native iOS/Android via React Native (Expo), focused exclusively on mobilePROMPT — Describe your app idea in plain English and Rork generates deployable, store-ready codeFUND — Rork raised $2.8M from a16z and reportedly sees 743,000 monthly visits at 85% growthPRICE — Free to start with paid plans from $25/month, though some users note heavy credit consumptionMAX — Rork Max generates native Swift for every Apple platform, from iPhone to Vision ProPUBLISH — Publish to the App Store in two clicks without Xcode, reaching iOS distribution without Mac hardwareNATIVE — Standard Rork builds native iOS/Android via React Native (Expo), focused exclusively on mobilePROMPT — Describe your app idea in plain English and Rork generates deployable, store-ready codeFUND — Rork raised $2.8M from a16z and reportedly sees 743,000 monthly visits at 85% growthPRICE — Free to start with paid plans from $25/month, though some users note heavy credit consumption
Articles/Dev Tools
Dev Tools/2026-06-20Advanced

Why Your Rork List Starts Duplicating and Dropping Rows as It Grows — Cursor Pagination and Resilient Refetch State

The naive offset pagination Rork scaffolds for you quietly breaks the moment your list changes underneath the user. Here is how to move to a cursor contract, fold every fetch state into one usePaginatedList hook, and recover failed page loads with exponential backoff — implementation first.

Rork427React Native170Expo88paginationinfinite scrollFlatList8state design

Premium Article

A list that felt fine at 50 rows fell apart at 3,000

As an indie developer, a list screen I run in one of my own apps slowly started misbehaving as the data grew. For the first few dozen rows everything was flawless. But once the records crossed a few thousand, the same card would appear twice mid-scroll, a handful of rows would vanish entirely, and the spinner at the bottom would sometimes turn forever.

When I traced it, I landed on the simple pagination Rork had scaffolded for me at the start: offset pagination — "give me n rows starting at position k." It works perfectly in a prototype. But on a list that keeps moving — new posts arriving, old ones removed — that approach fails silently in production.

This article unpacks why that failure happens, then rebuilds the list around a cursor contract and a single state machine for all the fetch states, in real code. Think of it as a set of notes for taking a list the AI got you started on and reworking it into something that holds up over the long run.


Why offset pagination "breaks while it's still working"

Offset pagination slices data by "starting at row k (offset), take n rows (limit)." Page one is offset=0, limit=20; page two is offset=20, limit=20.

The trouble is that the offset points at a rank. In the few seconds a user spends reading page one, suppose a new row is inserted at the top. Everything shifts back by one, and the row that should have led page two is now the same item already shown at the end of page one. That is your duplicate. Delete a row at the top instead and everything shifts forward by one, so a row gets skipped.

AspectOffsetCursor
What it points atA rank (row number)A boundary value (after this id)
List mutates mid-fetchDuplicates and gaps appearBoundary is fixed, so it stays stable
Deep-page performanceSlows down as offset growsStays roughly constant with an index
Jumping to a previous pageEasyNeeds a bidirectional cursor
Fit for infinite scrollLowHigh

For "keep reading forward" use cases like infinite scroll, carrying the boundary itself — "how far have I read?" — makes far more sense than carrying a rank. That is cursor pagination.


Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Understand why offset pagination breaks and design a cursor contract that never duplicates or skips rows while the list mutates
Fold initial load, load-more, refresh, error, and end-of-list into a single state machine inside a usePaginatedList hook
Add exponential-backoff retries for failed page fetches and id-based de-duplication for stable keys — everything a production list needs
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-06-20
Bugs Rork Can Fix vs. Bugs You Should Fix Yourself: A Triage Workflow for Exported Code
A practical triage workflow for telling apart the bugs Rork resolves on its own from the ones you should hand-fix in exported React Native/Expo code, with working examples.
Dev Tools2026-06-19
When Rork-Built Lists Stutter: Designing Image Caching and Prefetch
A FlatList from Rork starts stuttering once the images pile up. Here is how I restore smoothness with expo-image caching, recyclingKey, prefetch, and a move to FlashList, with the device numbers I measured.
Dev Tools2026-06-16
Notifications You Can Finish Without Opening the App — Interactive Notification Actions for Rork Apps
Those buttons and text fields that appear when you long-press a notification. Here is how to implement interactive notification actions in a Rork-built Expo app for an experience that completes without launching, including the background-execution pitfalls.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →