Closes #1203 - #1416
Open
mansur-codes wants to merge 3 commits into
Open
Conversation
…d/confirmed entries (Epta-Node#1203)
|
@mansur-codes Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@mansur-codes is attempting to deploy a commit to the Jaja's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where an optimistic like written to
OptimisticStorewas never reconciled when a feed refetch (e.g. switching to a "following-only" filter) removed the target post from the visible set, or when the server confirmed a different state for that post. This allowed stale "liked" state to resurrect on a later refetch or tab switch.Added a
reconcileFeed(userAddress, visiblePosts)method toOptimisticStore(apps/web/src/lib/optimisticStore.ts) that, on every feed refresh, deletes optimistic like/tip entries belonging to the current user for posts that are either no longer visible (filtered out) or now present in the fresh server response (server wins, since deletion causes the relevant hook to fall back toinitialState, which reflects server truth). Entries for other users are left untouched.Wired
OptimisticStore.reconcileFeed()intoapps/web/src/app/feed/page.tsxat the three points where fresh posts are set: afterfetchExploreFeed, afterfetchFollowingFeed(with results), and after the empty-following-list case.Deviation note: the original issue listed
apps/web/src/components/Feed.tsxas a file to modify. On investigation,Feed.tsxis a purely presentational component with no interaction withOptimisticStoreor the fetch lifecycle — all relevant logic lives infeed/page.tsx.Feed.tsxwas left unmodified;feed/page.tsxwas substituted as the correct fix location.Known gap for follow-up: the new unit tests in
optimisticStore.test.tspass standalone vianpx jest, butapps-webcurrently has no"test"script wired into the turbo pipeline, sopnpm testat the monorepo root does not yet execute them. This is a pre-existing gap unrelated to this fix — flagging for visibility.Type of Change
Testing Done
cargo testpasses (not applicable — this is a TypeScript/web change)Added
apps/web/src/lib/optimisticStore.test.tscovering: filtered-out post pruned, server-wins-for-present-post, tip state pruned (absent and present cases), cross-user entries left untouched, and listener notification. All 6 pass vianpx jest src/lib/optimisticStore.test.ts.pnpm typecheck,pnpm build, andpnpm lintpass forapps-webspecifically; monorepo-wide failures inlinkora-sdkandcontractsare pre-existing and unrelated to files touched here (confirmed by greppingtscoutput foroptimisticStore/feed/pagewith zero matches).Checklist
Related Issue
Closes #1203