@@ -977,6 +977,7 @@ import {
977977 resolveProviderSlashCommandsForCwd ,
978978} from "@t3tools/client-runtime/providerSkills" ;
979979import { searchProviderSkills } from "../../providerSkillSearch" ;
980+ import { useDelayedStatus } from "../../hooks/useDelayedStatus" ;
980981import { useMediaQuery } from "../../hooks/useMediaQuery" ;
981982import { usePanelAnimationSettings } from "../../panelAnimations" ;
982983import { useAtomCommand } from "../../state/use-atom-command" ;
@@ -1578,16 +1579,21 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
15781579 onFileOpen,
15791580 } = props ;
15801581 const primaryEnvironmentId = usePrimaryEnvironmentId ( ) ;
1581- const activeTasksProgress = props . threadSyncPhase === null ? props . activeTasksProgress : null ;
1582- const activeTaskSteps = props . threadSyncPhase === null ? props . activeTaskSteps : null ;
1582+ const composerDraftTargetKey = composerTargetKey ( composerDraftTarget ) ;
1583+ // Opening a running thread resyncs for a few frames. Show the sync row, and
1584+ // hide the tasks row for it, only when the sync lasts. Logic that depends on
1585+ // the real phase keeps reading `props.threadSyncPhase`.
1586+ const shownSyncPhase = useDelayedStatus ( composerDraftTargetKey , props . threadSyncPhase ) ;
1587+ const activeTasksProgress = shownSyncPhase === null ? props . activeTasksProgress : null ;
1588+ const activeTaskSteps = shownSyncPhase === null ? props . activeTaskSteps : null ;
15831589 // ------------------------------------------------------------------
15841590 // Store subscriptions (prompt / images / terminal contexts)
15851591 // ------------------------------------------------------------------
15861592 const composerDraft = useComposerThreadDraft ( composerDraftTarget ) ;
15871593 // Live target key, for async flows that must notice a thread switch that
15881594 // happened while they awaited.
15891595 const composerDraftTargetKeyRef = useRef ( "" ) ;
1590- composerDraftTargetKeyRef . current = composerTargetKey ( composerDraftTarget ) ;
1596+ composerDraftTargetKeyRef . current = composerDraftTargetKey ;
15911597 const questionAttachmentTarget =
15921598 pendingUserInputs [ 0 ] && activePendingProgress ?. activeQuestion
15931599 ? questionAttachmentDraftId (
@@ -5151,8 +5157,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
51515157 activeTaskSteps !== null &&
51525158 activeTasksProgress . totalSteps > 0 ;
51535159 const activityStackContent = hasBannerItems ? (
5154- props . threadSyncPhase ? (
5155- < ComposerActivityRow phase = { props . threadSyncPhase } />
5160+ shownSyncPhase ? (
5161+ < ComposerActivityRow phase = { shownSyncPhase } />
51565162 ) : ! hasBlockingComposerTopDrawer && activeTasksProgress && activeTaskSteps ? (
51575163 < ComposerTasksContent
51585164 expanded = { isTasksDrawerOpen }
@@ -6186,14 +6192,10 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
61866192 className = "relative z-0"
61876193 items = { bannerStackItems }
61886194 />
6189- { ! activityStackItem && ( props . threadSyncPhase || inlineTasksBadge ) ? (
6195+ { ! activityStackItem && ( shownSyncPhase || inlineTasksBadge ) ? (
61906196 < ComposerBanner . Attachment >
61916197 < ComposerBanner . Root data-chat-composer-activity-strip = "true" >
6192- { props . threadSyncPhase ? (
6193- < ComposerActivityRow phase = { props . threadSyncPhase } />
6194- ) : (
6195- inlineTasksBadge
6196- ) }
6198+ { shownSyncPhase ? < ComposerActivityRow phase = { shownSyncPhase } /> : inlineTasksBadge }
61976199 </ ComposerBanner . Root >
61986200 </ ComposerBanner . Attachment >
61996201 ) : null }
0 commit comments