Skip to content

Commit 870c9f0

Browse files
committed
refactor: stop pinning hardcoded main session in chat UI
1 parent 3b91148 commit 870c9f0

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
- Cron: parse Telegram topic targets for isolated delivery. (#478) — thanks @nachoiacovino
5959
- Cron: enqueue main-session system events under the resolved main session key. (#510)
6060
- Mobile: centralize main session key normalization for iOS/Android runtime helpers. — thanks @steipete
61+
- Chat UI: stop pinning hardcoded `main` session in the recent list; prefer active session if missing. — thanks @steipete
6162
- Outbound: default Telegram account selection for config-only tokens; remove heartbeat-specific accountId handling. (follow-up #516) — thanks @YuriNachos
6263
- Cron: allow Telegram delivery targets with topic/thread IDs (e.g. `-100…:topic:123`). (#474) — thanks @mitschabaude-bot
6364
- Heartbeat: resolve Telegram account IDs from config-only tokens; cron tool accepts canonical `jobId` and legacy `id` for job actions. (#516) — thanks @YuriNachos

apps/shared/ClawdbotKit/Sources/ClawdbotChatUI/ChatViewModel.swift

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,19 @@ public final class ClawdbotChatViewModel {
112112
recent.append(entry)
113113
}
114114

115-
let mainKey = "main"
116115
var result: [ClawdbotChatSessionEntry] = []
117116
var included = Set<String>()
118-
if let main = sorted.first(where: { $0.key == mainKey }) {
119-
result.append(main)
120-
included.insert(mainKey)
121-
} else if self.sessionKey == mainKey {
122-
result.append(self.placeholderSession(key: mainKey))
123-
included.insert(mainKey)
124-
}
125-
126117
for entry in recent where !included.contains(entry.key) {
127118
result.append(entry)
128119
included.insert(entry.key)
129120
}
130121

131122
if !included.contains(self.sessionKey) {
132-
result.append(self.placeholderSession(key: self.sessionKey))
123+
if let current = sorted.first(where: { $0.key == self.sessionKey }) {
124+
result.append(current)
125+
} else {
126+
result.append(self.placeholderSession(key: self.sessionKey))
127+
}
133128
}
134129

135130
return result

0 commit comments

Comments
 (0)