Prevents the 404 error banner that briefly flashes when switching back to the Chat tab. The WebSocket keeps the UI current, so the REST call is only needed on initial session load. Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
03866a611b
commit
2d8d3ac57a
1 file changed
+5
@@ -773,6 +773,11 @@ class ChatViewModel(
|
||||
fun refreshCurrentSession() {
|
||||
val sessionId = _uiState.value.currentSessionId ?: return
|
||||
loadCachedMessages(sessionId)
|
||||
// Skip the REST call if we already have messages — the WebSocket keeps
|
||||
// the UI current. The REST endpoint can 404 on tab switch-back when the
|
||||
// WS session ID doesn't round-trip through the resolver (issue #366),
|
||||
// showing a misleading error banner while the connection is fine.
|
||||
if (_uiState.value.messages.isNotEmpty()) return
|
||||
loadSessionMessages(sessionId)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user