Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (16)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile OverviewGreptile SummaryThis PR successfully addresses cache synchronization issues between the anime details page and list view by implementing Apollo Client cache normalization instead of manual refetching. Key improvements:
The implementation properly leverages Apollo's normalized cache, ensuring UI updates propagate automatically across all components without manual synchronization. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DetailsPage as Details Page<br/>(app/details/[id].tsx)
participant Stepper as Stepper Component
participant Mutation as useDebouncedMutation
participant Cache as Apollo Cache
participant AnimeList as Anime List<br/>(app/(tabs)/anime.tsx)
participant Container as AnimeListItemContainer
User->>DetailsPage: Tap increment on Progress stepper
DetailsPage->>Stepper: onIncrement callback
DetailsPage->>Mutation: updateProgress({ progress: currentProgress + 1 })
Mutation->>Cache: cache.modify() - update MediaList.progress field
Cache-->>DetailsPage: Cache updated optimistically
DetailsPage->>User: UI shows new value instantly
Mutation->>Cache: SaveMediaListEntry mutation (GraphQL)
Cache-->>Mutation: Server response with { id, progress, status, score }
Cache->>Cache: Normalize response into cache (by id + __typename)
Note over Cache,AnimeList: Cache update triggers re-render
Cache-->>Container: mediaListEntry.progress updated
Container->>Container: useEffect detects cacheProgress change
Container->>Container: setDisplayProgress(cacheProgress)
Container->>User: Anime list item shows synced value
User->>DetailsPage: Navigate back to list
AnimeList->>Cache: Query with fetchPolicy: "cache-and-network"
Cache-->>AnimeList: Return cached data immediately
AnimeList->>User: Show updated progress (no flicker)
Cache->>AnimeList: Fetch fresh data in background
Cache-->>AnimeList: Server data (already matches cache)
|
6dfd6c9 to
3f34ca5
Compare
Why
The score/progress steppers could feel out of sync with what users just tapped because the UI waited on cache/network updates before reflecting changes. This update keeps the UI responsive while preserving cache as the source of truth.
How
displayScore,displayProgress) and list item containers (displayProgress) so taps render immediately.useEffectwhenever cache updates arrive.0..10.0..episodeswhen episode count exists, otherwise>=0.mediaListEntryIdor the value does not actually change.changeScore/changeProgresslogic and retained haptic feedback.wait: 0for immediate dispatch in these interactions.try/catch+console.error).Test Plan
Actions
bun run lintbunx tsc --noEmitAssertions
0or above10.0and does not exceed known episode count.Test Reproduction
Manual verification evidence is still needed (screen recording or screenshots from details -> list sync behavior).