mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 05:20:55 +00:00
🦔 fix: Keep System Messages Stable During Collapse (#16780)
Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
parent
114394c6a0
commit
cd4ae0f37f
2 changed files with 60 additions and 1 deletions
|
|
@ -164,7 +164,7 @@ const Wakeup = memo(function Wakeup({
|
|||
);
|
||||
|
||||
return (
|
||||
<div className={cn('max-w-full', isExpanded && 'w-[36rem]')}>
|
||||
<div className={cn('max-w-full', shouldRenderBody && 'w-[36rem]')}>
|
||||
<Button
|
||||
variant="ghost"
|
||||
type="button"
|
||||
|
|
|
|||
|
|
@ -95,6 +95,65 @@ const subagentDisplay = {
|
|||
};
|
||||
|
||||
describe('Wakeup', () => {
|
||||
it.each([
|
||||
['subagent', subagentDisplay, 'com_ui_wakeup_subagent_completed'],
|
||||
[
|
||||
'background tool',
|
||||
{
|
||||
kind: 'background_tool' as const,
|
||||
tasks: [
|
||||
{
|
||||
taskId: 'bg-wide',
|
||||
status: 'completed' as const,
|
||||
result: 'wide output '.repeat(200),
|
||||
toolName: 'bash_tool',
|
||||
},
|
||||
],
|
||||
},
|
||||
'com_ui_wakeup_task_finished',
|
||||
],
|
||||
])('holds the %s width until its closing body unmounts', (_kind, display, label) => {
|
||||
render(
|
||||
<ChatSurfaceHarness>
|
||||
<RecoilRoot>
|
||||
<Wakeup display={display} conversationId="conversation-1" />
|
||||
</RecoilRoot>
|
||||
</ChatSurfaceHarness>,
|
||||
);
|
||||
|
||||
const header = screen.getByRole('button', { name: label });
|
||||
const panel = screen.getByTestId('wakeup-panel');
|
||||
const card = header.parentElement;
|
||||
expect(card).not.toHaveClass('w-[36rem]');
|
||||
expect(panel).toBeEmptyDOMElement();
|
||||
|
||||
fireEvent.click(header);
|
||||
expect(card).toHaveClass('w-[36rem]');
|
||||
expect(panel).not.toBeEmptyDOMElement();
|
||||
|
||||
fireEvent.click(header);
|
||||
expect(header).toHaveAttribute('aria-expanded', 'false');
|
||||
expect(panel).toHaveAttribute('aria-hidden', 'true');
|
||||
expect(panel.firstElementChild).toHaveAttribute('inert');
|
||||
expect(card).toHaveClass('w-[36rem]');
|
||||
expect(panel).not.toBeEmptyDOMElement();
|
||||
|
||||
fireEvent.transitionEnd(panel.firstElementChild!);
|
||||
expect(card).toHaveClass('w-[36rem]');
|
||||
expect(panel).not.toBeEmptyDOMElement();
|
||||
|
||||
fireEvent.click(header);
|
||||
fireEvent.transitionEnd(panel);
|
||||
expect(header).toHaveAttribute('aria-expanded', 'true');
|
||||
expect(card).toHaveClass('w-[36rem]');
|
||||
expect(panel).not.toBeEmptyDOMElement();
|
||||
|
||||
fireEvent.click(header);
|
||||
fireEvent.transitionEnd(panel);
|
||||
expect(card).not.toHaveClass('w-[36rem]');
|
||||
expect(panel).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('renders a collapsible subagent completion card with the result and panel affordance', () => {
|
||||
render(
|
||||
<ChatSurfaceHarness>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue