fix(users): invalidate recommended stream cache on follow#1625
Draft
fix(users): invalidate recommended stream cache on follow#1625
Conversation
Clear the recommended:all:all user stream from IndexedDB when a user is followed so the Who to Follow card shows fresh suggestions on next mount. Made-with: Cursor
Collaborator
Author
|
@greptileai review |
Contributor
Greptile SummaryThis PR adds a targeted cache invalidation for the
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/core/services/local/follow/follow.ts | Adds four-line cache invalidation for the recommended:all:all user stream when a follow action is performed, ensuring fresh suggestions on next mount of the Who to Follow card. |
Sequence Diagram
sequenceDiagram
participant UI as UI / Controller
participant LFS as LocalFollowService
participant LSUS as LocalStreamUsersService
participant LSPS as LocalStreamPostsService
participant IDB as IndexedDB
UI->>LFS: create({ follower, followee, activeStreamId })
LFS->>IDB: transaction(rw) — update connections, counts, relationships
IDB-->>LFS: committed
LFS->>LFS: updateUserStreams({ isFollowing: true, ... })
par Follow stream ops
LFS->>LSUS: prependToStream(follower:following, [followee])
LFS->>LSUS: prependToStream(followee:followers, [follower])
LFS->>LSUS: deleteById("recommended:all:all") ← new
LFS->>LSPS: deleteById(timelineStreamId)
end
LSUS->>IDB: delete "recommended:all:all" cache
LSPS->>IDB: delete timeline stream cache
IDB-->>LFS: done
LFS-->>UI: resolved
Note over UI,IDB: Next mount of Who to Follow card<br/>finds no cache → fetches fresh from Nexus
Reviews (1): Last reviewed commit: "Merge branch 'dev' into fix/1224-who-to-..." | Re-trigger Greptile
🚀 Preview DeploymentURL: https://franky-preview-pr-1625-fzxmjul7ya-oa.a.run.app
|
The sidebar WhoToFollow component stays mounted across route changes (layout). In production (no React Strict Mode), the cache invalidation on follow needs an explicit refetch trigger when the pathname changes. Made-with: Cursor
ba090e4 to
523b7d3
Compare
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.
Clear the recommended:all:all user stream from IndexedDB when a user is followed so the Who to Follow card shows fresh suggestions on next mount.
Made-with: Cursor