Infinite Scroll, Infinite Repeats — JavaScript Bug Hunt
Inspired by every infinite feed that shows you the same clip twice.
- Language: JavaScript
- Layer: Frontend
- Difficulty: Easy
- Concepts: Pagination, Dedupe
- Modelled on: TikTok feeds
- Visible tests: overlapping items appear once; disjoint pages append cleanly
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-3
- Time to fix: 10 minutes, the target for an easy incident
Failing checks on the shipped build
- overlapping items appear once — expected [8,7,6,5,4] but got [8,7,6,6,5,4]
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the value the screen shows back through the state and the pure helpers that compute it; the view is usually only the messenger.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Inspired by every infinite feed that shows you the same clip twice. Page boundaries shift while you scroll (new posts push everything down), so incoming pages overlap what's already rendered.
feedMerge.js must append only the truly-new items, preserving order.
Bug report
BUG-∞ · Reported by: feed QA
mergePage(existing, incoming) contract:
- keep every existing item, in order
- append only incoming items whose id is not already present, in their order
Observed: raw concatenation — users see duplicates on every page boundary.
Logs
[feed] rendered ids: [8,7,6,5, 6,5,4,3] <- 6 and 5 repeatedThe code as shipped
src/feed/feedMerge.js (editable)
// Appends an incoming page to the already-rendered feed.
exports.mergePage = function (existing, incoming) {
return existing.concat(incoming);
};
Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.