@@ -19,7 +19,8 @@ import { type TerminalLaunchContext, useChatTerminalActions } from "./chat/useCh
1919import { useComposerSend } from "./chat/useComposerSend" ;
2020import { useComposerResume } from "./chat/useComposerResume" ;
2121import { useImplementPlanInNewThread } from "./chat/useProposedPlanSend" ;
22- import { ThreadFind , ThreadFindCanvas , type ThreadFindControls } from "./chat/ThreadFindProvider" ;
22+ import { ThreadFind , ThreadFindCanvas } from "./chat/ThreadFindProvider" ;
23+ import { closeThreadFind , openThreadFind , useThreadFindOpen } from "./chat/threadFindStore" ;
2324import { THREAD_FIND_BAR_RESERVED_HEIGHT } from "./chat/ThreadFindBar" ;
2425import { usageLimitRecoveryBannerItem } from "./chat/UsageLimitRecoveryBanner" ;
2526import { resolveDraftHeroState } from "./ChatView.logic" ;
@@ -2656,10 +2657,9 @@ export default function ChatView(props: ChatViewProps) {
26562657 const timelineSkills = activeProviderStatus
26572658 ? resolveProviderSkillsForCwd ( activeProviderStatus , gitCwd )
26582659 : EMPTY_PROVIDER_SKILLS ;
2659- const threadFindControlsRef = useRef < ThreadFindControls | null > ( null ) ;
2660- const [ isThreadFindActive , setIsThreadFindActive ] = useState ( false ) ;
2661- const openThreadFind = ( ) => threadFindControlsRef . current ?. open ( ) ;
2662- const closeThreadFind = ( ) => threadFindControlsRef . current ?. close ( ) ;
2660+ const threadFindEnabled =
2661+ isServerThread && serverConfig ?. threadFind === true && ! paintOnlyDisplayedTimeline ;
2662+ const isThreadFindActive = useThreadFindOpen ( activeThreadRef , threadFindEnabled ) ;
26632663
26642664 useChatShortcuts ( {
26652665 enabled : activeThreadId !== null && ! backgroundThread ,
@@ -2681,8 +2681,9 @@ export default function ChatView(props: ChatViewProps) {
26812681 if ( ! event . repeat ) copyActiveThreadReference ( ) ;
26822682 } ,
26832683 "chat.find" : ( ) => {
2684- if ( ! isServerThread || serverConfig ?. threadFind !== true ) return false ;
2685- openThreadFind ( ) ;
2684+ if ( ! isServerThread || serverConfig ?. threadFind !== true || activeThreadKey === null )
2685+ return false ;
2686+ openThreadFind ( activeThreadKey ) ;
26862687 } ,
26872688 "composer.cycleHost" : ( { event } ) => {
26882689 if ( ! canChangeEnvironment ) return false ;
@@ -3208,11 +3209,8 @@ export default function ChatView(props: ChatViewProps) {
32083209 skills : timelineSkills ,
32093210 progressive : serverConfig ?. threadFindProgressive === true ,
32103211 thread : activeThreadRef ,
3211- enabled :
3212- isServerThread && serverConfig ?. threadFind === true && ! paintOnlyDisplayedTimeline ,
3212+ enabled : threadFindEnabled ,
32133213 } }
3214- controlsRef = { threadFindControlsRef }
3215- onOpenChange = { setIsThreadFindActive }
32163214 detailsCardTopInset = { isThreadFindActive ? THREAD_FIND_BAR_RESERVED_HEIGHT : 0 }
32173215 composerOverlayElement = { isDraftHeroState ? null : composerOverlayElement }
32183216 data-chat-workspace-drop-target = "true"
0 commit comments