The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
perf(tui): memoize useSessionLifecycle return (idea from #38491)
asill-livestream128ca2efd559
diff --git a/ui-tui/src/app/useSessionLifecycle.ts b/ui-tui/src/app/useSessionLifecycle.tsindex 13dab7ce4cb..ee8fbe5f2c3 100644--- a/ui-tui/src/app/useSessionLifecycle.ts+++ b/ui-tui/src/app/useSessionLifecycle.ts@@ -2,7 +2,7 @@ import { writeFileSync } from 'node:fs'import type { ScrollBoxHandle } from '@hermes/ink'import { evictInkCaches } from '@hermes/ink'-import { type RefObject, useCallback, useEffect, useRef } from 'react'+import { type RefObject, useCallback, useEffect, useMemo, useRef } from 'react'import { buildSetupRequiredSections, SETUP_REQUIRED_TITLE } from '../content/setup.js'import { introMsg, toTranscriptMessages } from '../domain/messages.js'@@ -423,15 +423,28 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {[sys])- return {- activateLiveSession,- closeSession,- guardBusySessionSwitch,- newLiveSession,- newSession,- resetSession,- resetVisibleHistory,- resumeById,- trimLastExchange: trimTail- }+ return useMemo(+ () => ({+ activateLiveSession,+ closeSession,+ guardBusySessionSwitch,+ newLiveSession,+ newSession,+ resetSession,+ resetVisibleHistory,+ resumeById,+ trimLastExchange: trimTail+ }),+ [+ activateLiveSession,+ closeSession,+ guardBusySessionSwitch,+ newLiveSession,+ newSession,+ resetSession,+ resetVisibleHistory,+ resumeById,+ trimTail+ ]+ )}