Skip to content

fix: deduplicate posts in feed to prevent duplicate rendering#5577

Merged
pnvasanth merged 1 commit intomainfrom
fix/feed-dedup-fallback
Feb 26, 2026
Merged

fix: deduplicate posts in feed to prevent duplicate rendering#5577
pnvasanth merged 1 commit intomainfrom
fix/feed-dedup-fallback

Conversation

@pnvasanth
Copy link
Contributor

@pnvasanth pnvasanth commented Feb 25, 2026

Summary

  • Add Set-based post ID deduplication in the useFeed hook's items useMemo
  • When flattening pages into feed items, posts already seen in earlier pages are skipped

Why

When feed cache regenerates mid-session, the stale cursor response returns first-page content as a subsequent page. Even with the staleCursorresetQueries mechanism, there's a brief render window where duplicate pages coexist. This client-side dedup ensures users never see duplicate posts regardless of backend timing.

Related

Test plan

  • Load feed, scroll through multiple pages — no duplicates
  • Simulate cache regeneration mid-session — no duplicates visible

Preview domain

https://fix-feed-dedup-fallback.preview.app.daily.dev

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Feb 26, 2026 11:56am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored Feb 26, 2026 11:56am

Request Review

const plusEntryAsFirstCard = settings?.plusEntry?.flags?.asFirstCard;

if (feedQuery.data) {
const seenPostIds = new Set<string>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against it but just waiting for Ante to check the API part

Add a Set-based dedup in the items useMemo as a defensive fallback.
When pages contain overlapping posts (e.g. stale cursor returns first
page content as page 2), duplicates are now skipped client-side.
@pnvasanth pnvasanth force-pushed the fix/feed-dedup-fallback branch from 1d7c0a1 to 17f6230 Compare February 26, 2026 11:53
@pnvasanth pnvasanth merged commit e10c8e4 into main Feb 26, 2026
11 checks passed
@pnvasanth pnvasanth deleted the fix/feed-dedup-fallback branch February 26, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants