From 3565f77171af7ca34038073d872326732c07d3ed Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:45:34 +0200 Subject: [PATCH] fix(client): compose shared buttons for two disclosures and seed re-enabled ask drafts Compose the shared Button for the memory-artifacts and web-search disclosure rows, keeping only their geometry local. The web-search row keeps its instant hover by suppressing the recipe's color transition, since the chevron beside it reveals without a fade and the existing test pins that. Seed the ask-specific draft when Save drafts is re-enabled. An answer captured while saving was off has no persisted ask draft for autosave to restore, so expanding opened an empty composer and the next collapse read that empty value back over the in-memory answer. --- .../Chat/Messages/Content/MemoryArtifacts.tsx | 10 +++++----- .../Chat/Messages/Content/WebSearch.tsx | 16 +++++++++------- client/src/hooks/Input/useAskAnswerMode.ts | 8 ++++++++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx index 387b7de6c3..d1538d313d 100644 --- a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx +++ b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx @@ -1,7 +1,7 @@ import { useId, useMemo, useState } from 'react'; import { ChevronDown } from 'lucide-react'; import { Tools } from 'librechat-data-provider'; -import { disclosureChevronVariants } from '@librechat/client'; +import { Button, disclosureChevronVariants } from '@librechat/client'; import type { MemoryArtifact, TAttachment } from 'librechat-data-provider'; import { toolPanelSpacingClassName } from './disclosure'; import { useExpandCollapse, useLocalize } from '~/hooks'; @@ -61,12 +61,12 @@ export default function MemoryArtifacts({ attachments }: { attachments?: TAttach return ( <>
- +
- + {hasDetails && ( {/* Composed through `asChild` so the shared Button owns the diff --git a/client/src/hooks/Input/useAskAnswerMode.ts b/client/src/hooks/Input/useAskAnswerMode.ts index a090aa8402..fe7cb6c01c 100644 --- a/client/src/hooks/Input/useAskAnswerMode.ts +++ b/client/src/hooks/Input/useAskAnswerMode.ts @@ -212,6 +212,14 @@ export default function useAskAnswerMode(conversationId?: string | null) { * drafts are disabled, perform that handoff directly. */ if (!batchMode && !saveDrafts) { formContext?.setValue('text', answerText); + } else if (!batchMode && answerText) { + /** Drafts were re-enabled after this answer was captured with saving + * off, so no ask draft exists for autosave to restore: the composer + * would open empty and the next collapse would read that empty + * value back over the in-memory answer. Seed it so the handoff has + * something to read. The in-memory value is authoritative because + * `setAnswerText` writes both while saving is on. */ + setDraft({ id: getAskAnswerDraftId(liveAsk.actionId), value: answerText }); } setCollapsedIds((prev) => prev.filter((id) => id !== liveAsk.actionId)); });