Repository navigation
fix(chat): keep a just-joined group when an older group feed lands - #1240
Merged
Merged
Conversation
After tapping Join, the user could land on an empty "Flipcash User" conversation. A group feed requested before the join can be applied after it; `setGroupFeed` read the group's absence as a departure, removed it from the store and deleted it from the DB, so the open screen could not find its conversation. The store now stamps each membership it seats (join, create, roster join) with a generation. The controller reads `groupFeedMark` before a group feed is requested and passes it to `setGroupFeed(_:requestedAt:)`, which keeps groups seated after that mark, still joined and out of `departed`. A group missing from a feed requested after it was seated is still dropped.
bmc08gt
added a commit
that referenced
this pull request
Nov 9, 2026
…#1241) Follows #1240. Leaving a group while a group feed was in flight was undone when that feed landed: `setMembership(false)` dropped the group's stamp, so `setGroupFeed` saw the stale listing, marked the user joined again, and `replaceGroupFeed` wrote membership=true to the DB. The stamp now records every membership change, join or leave. For a group changed after a feed's `requestedAt` mark, local membership wins: a join is kept, a leave stays un-joined. The left group's row is kept so the screen the user left from can still render its gate, and the controller records only still-joined groups through `replaceGroupFeed`. A feed requested after the change is trusted fully.
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.
After tapping Join, the user sometimes lands on an empty conversation titled "Flipcash User"; joining again works.
Cause
ConversationController.reconcileFeeds()fetchesGetGroupChatFeed, then waits for the other feeds and unread counts beforeapplyFeed; a late feed applies on its own.loadGroupFeed()is the same shape. The snapshot can predate a join.seatJoinedupserts the group and callsstore.setMembership(true).ConversationStore.setGroupFeedcomputesdeparted = joinedGroupIDs.subtracting(feed), which includes the new group. It is removed fromconversations, andreplaceGroupFeed(..., departed:)deletes it from the DB..undetermined. Its hydrate task runs once, so nothing restores it.loadFeedwhile the user taps Join.seatCreatedGrouphas the same window.Fix
ConversationStore.setMembership(true, ...)stamps the group with a generation;groupFeedMarkexposes the current one.setGroupFeed(_:requestedAt:)keeps groups seated after the mark: they stay in the store, stay joined, and are excluded fromdeparted.reconcileFeeds()andloadGroupFeed()read the mark before fetching and pass it on apply, including the late-arrival path.Not changed: re-hydrating the screen when its conversation drops out of the store. The store fix removes the trigger, and a second restore path adds risk to the screen's load flow.