Skip to content

Commit f7c6a02

Browse files
committed
docs(web): docstring coverage for Stop-while-starting helpers
CodeRabbit's docstring check was at 75% on the functions this diff touches. Document the composer helpers so coverage clears 80%. Co-authored-by: maco <[email protected]>
1 parent 2113265 commit f7c6a02

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,13 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
11851185
);
11861186
});
11871187

1188-
const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(props: {
1188+
/**
1189+
* Context meter and primary composer controls.
1190+
*
1191+
* Forwards interrupt eligibility so Stop is offered while a session is still
1192+
* starting, not only after the turn is running.
1193+
*/
1194+
function ComposerFooterPrimaryActions(props: {
11891195
compact: boolean;
11901196
activeContextWindow: ContextWindowSnapshot | null;
11911197
reserveContextWindowMeter: boolean;
@@ -1248,7 +1254,9 @@ const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(
12481254
/>
12491255
</>
12501256
);
1251-
});
1257+
}
1258+
1259+
const MemoizedComposerFooterPrimaryActions = memo(ComposerFooterPrimaryActions);
12521260

12531261
// --------------------------------------------------------------------------
12541262
// Handle exposed to ChatView
@@ -1485,7 +1493,13 @@ export interface ChatComposerProps {
14851493
// Component
14861494
// --------------------------------------------------------------------------
14871495

1488-
export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) {
1496+
/**
1497+
* Draft composer for a thread, including attachments and the primary action.
1498+
*
1499+
* Interrupt eligibility follows the session, so Stop stays available while a
1500+
* session is still starting.
1501+
*/
1502+
function ChatComposer(props: ChatComposerProps) {
14891503
const {
14901504
composerDraftTarget,
14911505
environmentId,
@@ -7015,7 +7029,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
70157029
</Tooltip>
70167030
</>
70177031
) : null}
7018-
<ComposerFooterPrimaryActions
7032+
<MemoizedComposerFooterPrimaryActions
70197033
compact={isComposerResting || isComposerPrimaryActionsCompact}
70207034
activeContextWindow={
70217035
settings.contextWindowMeterEnabled ? activeContextWindow : null
@@ -7057,4 +7071,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
70577071
</div>
70587072
</form>
70597073
);
7060-
});
7074+
}
7075+
7076+
const MemoizedChatComposer = memo(ChatComposer);
7077+
export { MemoizedChatComposer as ChatComposer };

‎apps/web/src/components/chat/ComposerPrimaryActions.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ const preventPointerFocus: PointerEventHandler<HTMLElement> = (event) => {
6767
event.preventDefault();
6868
};
6969

70-
export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
70+
/**
71+
* Send, Stop, and pending-question controls for the composer.
72+
*
73+
* While a session can be interrupted before provider work starts, Stop is the
74+
* only primary control, even if the draft already has text. A running turn
75+
* keeps Send beside Stop once there is something to send.
76+
*/
77+
function ComposerPrimaryActions({
7178
compact,
7279
pendingAction,
7380
isRunning,
@@ -296,4 +303,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
296303
{hasSendableContent ? sendButton : null}
297304
</>
298305
);
299-
});
306+
}
307+
308+
const MemoizedComposerPrimaryActions = memo(ComposerPrimaryActions);
309+
export { MemoizedComposerPrimaryActions as ComposerPrimaryActions };

0 commit comments

Comments
 (0)