Skip to content

Your lightweight open-source personal agent.

fix(webui): stabilize empty session history state

Xubin Renb3049f732310
diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py
index 5966d5200..b970d9201 100644
--- a/tests/cli/test_commands.py
+++ b/tests/cli/test_commands.py
@@ -1212,7 +1212,7 @@ def test_gateway_health_endpoint_binds_and_serves_expected_responses(
return None
class _FakeChannelManager:
- def __init__(self, _config, _bus) -> None:
+ def __init__(self, _config, _bus, **_kwargs) -> None:
self.enabled_channels = ["telegram", "discord"]
async def start_all(self) -> None:
diff --git a/webui/src/hooks/useSessions.ts b/webui/src/hooks/useSessions.ts
index 9e3901bdf..b627f8607 100644
--- a/webui/src/hooks/useSessions.ts
+++ b/webui/src/hooks/useSessions.ts
@@ -11,6 +11,8 @@ import {
import { deriveTitle } from "@/lib/format";
import type { ChatSummary, UIMessage } from "@/lib/types";
+const EMPTY_MESSAGES: UIMessage[] = [];
+
/** Sidebar state: fetches the full session list and exposes create / delete actions. */
export function useSessions(): {
sessions: ChatSummary[];
@@ -163,13 +165,13 @@ export function useSessionHistory(key: string | null): {
}, [key, token]);
if (!key) {
- return { messages: [], loading: false, error: null };
+ return { messages: EMPTY_MESSAGES, loading: false, error: null };
}
// Even before the effect above commits its loading state, never surface the
// previous session's payload for a brand-new key.
if (state.key !== key) {
- return { messages: [], loading: true, error: null };
+ return { messages: EMPTY_MESSAGES, loading: true, error: null };
}
return {