@@ -1824,8 +1824,21 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
18241824 } ,
18251825 } ) ;
18261826 const { blocksSubmission : voiceInputActive , submitAfterDictation } = speechInput ;
1827- const voiceSendDisabledReason =
1828- sendDisabledReason ?? ( speechInput . preparing ? "Preparing voice input" : null ) ;
1827+ const submissionTarget = activePendingProgress ? "pending-user-input" : "provider-turn" ;
1828+ const submissionBlocked = isComposerSubmissionBlocked ( {
1829+ submissionTarget,
1830+ noProviderAvailable,
1831+ sendDisabledReason,
1832+ attachmentBlockReason,
1833+ environmentUnavailable : environmentUnavailable !== null ,
1834+ } ) ;
1835+ // The pending Submit button follows the answer's own blockers, matching submitComposer.
1836+ const primaryActionSendDisabledReason =
1837+ ( activePendingProgress ? attachmentBlockReason : sendDisabledReason ) ??
1838+ ( speechInput . preparing ? "Preparing voice input" : null ) ;
1839+ const primaryActionEnvironmentUnavailable =
1840+ environmentUnavailable !== null ||
1841+ ( ! activePendingProgress && ( noProviderAvailable || projectSelectionRequired ) ) ;
18291842 const dictationShortcutLabel = useDictationShortcut ( {
18301843 keybindings,
18311844 speech : speechInput ,
@@ -2071,13 +2084,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
20712084
20722085 const shouldBlurMobileComposerOnSubmit = ( ) => {
20732086 if ( ! isSoftwareKeyboardOpen ) return false ;
2074- if (
2075- isSendBusy ||
2076- isSendDisabled ||
2077- noProviderAvailable ||
2078- environmentUnavailable !== null ||
2079- phase === "running"
2080- ) {
2087+ if ( isSendBusy || submissionBlocked || environmentUnavailable !== null || phase === "running" ) {
20812088 return false ;
20822089 }
20832090 if ( activePendingProgress ) {
@@ -2099,17 +2106,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
20992106 submitAfterDictation ( ( ) => submitComposerRef . current ( dispatchMode , submissionIntent ) ) ;
21002107 return false ;
21012108 }
2102- const submissionTarget = activePendingProgress ? "pending-user-input" : "provider-turn" ;
2103- if (
2104- isComposerSubmissionBlocked ( {
2105- submissionTarget,
2106- noProviderAvailable,
2107- sendDisabledReason,
2108- attachmentBlockReason,
2109- environmentUnavailable : environmentUnavailable !== null ,
2110- } ) ||
2111- ! readEnvironmentScope ( environmentId , AuthOrchestrationOperateScope )
2112- ) {
2109+ if ( submissionBlocked || ! readEnvironmentScope ( environmentId , AuthOrchestrationOperateScope ) ) {
21132110 event ?. preventDefault ( ) ;
21142111 return false ;
21152112 }
@@ -3531,12 +3528,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
35313528 isRunning = { false }
35323529 canInterrupt = { false }
35333530 isSendBusy = { isSendBusy }
3534- sendDisabledReason = { voiceSendDisabledReason }
3535- isEnvironmentUnavailable = {
3536- environmentUnavailable !== null ||
3537- noProviderAvailable ||
3538- projectSelectionRequired
3539- }
3531+ sendDisabledReason = { primaryActionSendDisabledReason }
3532+ isEnvironmentUnavailable = { primaryActionEnvironmentUnavailable }
35403533 isPreparingWorktree = { false }
35413534 hasSendableContent = { false }
35423535 preserveComposerFocusOnPointerDown
@@ -3615,12 +3608,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
36153608 ) }
36163609 voiceInputActive = { voiceInputActive }
36173610 isSendBusy = { isSendBusy }
3618- sendDisabledReason = { voiceSendDisabledReason }
3619- isEnvironmentUnavailable = {
3620- environmentUnavailable !== null ||
3621- noProviderAvailable ||
3622- projectSelectionRequired
3623- }
3611+ sendDisabledReason = { primaryActionSendDisabledReason }
3612+ isEnvironmentUnavailable = { primaryActionEnvironmentUnavailable }
36243613 isPreparingWorktree = { isPreparingWorktree }
36253614 hasSendableContent = { composerSendState . hasSendableContent || voiceInputActive }
36263615 canResume = { showResumeAction }
0 commit comments