Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): clear pending chat selections on reset
Josuécd240b10a6d4
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/chatActions.characterization.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/chatActions.characterization.test.tsxindex b5eefea99..5624ea5c4 100644--- a/desktop-app/ui/src/hooks/domain/__tests__/chatActions.characterization.test.tsx+++ b/desktop-app/ui/src/hooks/domain/__tests__/chatActions.characterization.test.tsx@@ -124,6 +124,27 @@ describe('resetChat / clearActiveChat', () => {expect(result.current.chatMessages).toEqual([])})+ it('resetChat drops pending selections from the prior session', async () => {+ const { result, rerender } = renderController({ agentNames: ['agent-x', 'agent-y'] })+ await settleMount()++ act(() => {+ result.current.setPendingChatSelection('agent-y', 'prior-user-chat')+ result.current.resetChat()+ })+ rerender({ selectedAgent: 'agent-y', agentNames: ['agent-x', 'agent-y'] })++ await waitFor(() => expect(clerum.chat.getIndex).toHaveBeenCalledWith('agent-y'))+ expect(result.current.activeChatId).toBeNull()+ expect(clerum.rpc.loadSessionMessages).not.toHaveBeenCalledWith(+ 'agent-y',+ 'agent-y',+ 'prior-user-chat',+ undefined,+ expect.anything()+ )+ })+it('clearActiveChat deselects and drops the per-chat error/resend banner', async () => {clerum.rpc.invokeHostMessage.mockRejectedValue(new Error('network down'))const { result } = renderController()diff --git a/desktop-app/ui/src/hooks/domain/useChatListController.ts b/desktop-app/ui/src/hooks/domain/useChatListController.tsindex 1794cd44b..72597ecb7 100644--- a/desktop-app/ui/src/hooks/domain/useChatListController.ts+++ b/desktop-app/ui/src/hooks/domain/useChatListController.ts@@ -414,6 +414,7 @@ export function useChatListController({/** Reset the selected agent's list (logout teardown / load failure). */const clearList = useCallback(() => {+ pendingChatSelectionByAgentRef.current = {}chatListNextCursorByAgentRef.current = {}chatListLoadingMoreByAgentRef.current.clear()suppressAutoSelectionByAgentRef.current.clear()