Put in order · Vibe coding with Claude Code course · Module 14: Pinterest clone

Sorting: Loading a page of pins

Put in order what happens in PinFeed when the viewer gets close to the end of the list:

Items to put in order

  • setCursor(page.nextCursor), so the effect creates a new observer
  • The sentinel enters the widened observation area (isIntersecting)
  • setPins((prev) => [...prev, ...page.pins])
  • observer.disconnect(), so that one entry gives one request
  • fetch to /api/pins with the current cursor

You can check the correct answer by solving this task in the CodeWorlds game.