Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/connector/roomstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (r *RedditClient) roomState(ctx context.Context, roomID id.RoomID, joined *
return nil, networkid.PortalKey{}, unbridgeable(err)
}
if next.Type == "" {
// Reddit can send a new chat's members before its type.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

鈿笍 Nit 路 Cached untyped room state hides typed state saved by another login

previous is only loaded from the saved portal metadata when r.rooms[roomID] == nil. Now that the untyped state is cached here, later incremental syncs keep merging onto the untyped cache even if another login has since created the shared portal (Receiver "") and saved typed meta.State. Those syncs omit the chat type, so each one hits errMissingChatType again and triggers a full snapshot fetch. Before this change the DB projection was used right away. Consider falling back to the saved state when the cached previous.Type == "".

Found by Indent Review Agent

r.rooms[roomID] = next
return nil, networkid.PortalKey{}, unbridgeable(errMissingChatType)
}
key := r.makePortalKey(roomID, next.Type == "direct")
Expand Down
Loading