Skip to content

Commit 176cbf4

Browse files
committed
fix(mobile): preserve context during MCP reconnect
1 parent 1752617 commit 176cbf4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/mobile/src/state/use-thread-composer-state.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export function useThreadComposerState() {
395395
);
396396
const reconnectMcpCommand =
397397
attachments.length === 0 &&
398+
(draft.context?.records.length ?? 0) === 0 &&
398399
(provider?.driver === "codex" || thread.session?.providerName === "codex") &&
399400
isReconnectMcpCommand(text);
400401
if (reconnectMcpCommand) {
@@ -419,7 +420,11 @@ export function useThreadComposerState() {
419420
});
420421
if (result._tag === "Failure") {
421422
const currentDraft = getComposerDraftSnapshot(threadKey);
422-
if (currentDraft.text.length === 0 && currentDraft.attachments.length === 0) {
423+
if (
424+
currentDraft.text.length === 0 &&
425+
currentDraft.attachments.length === 0 &&
426+
(currentDraft.context?.records.length ?? 0) === 0
427+
) {
423428
setComposerDraftText(threadKey, text);
424429
}
425430
if (!isAtomCommandInterrupted(result)) {

0 commit comments

Comments
 (0)