char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
92d1bb0c9
char/aliceai-t5-moe
1// Guards the lazy-body behaviour of the shared collapsible wrappers. 2// 3// bits-ui's Collapsible.Content renders its children unconditionally and only 4// sets `hidden`, so before this was gated a collapsed tool result kept its whole 5// body in the DOM and re-rendered it on every streamed token (measured at 6// ~41ms/section/token for a 200KB result). These tests pin the fix: closed means 7// not rendered, and opening still mounts the body. 8 9import CollapsibleLazyBodyHarness from './components/CollapsibleLazyBodyHarness.svelte' ; 10import { tick } from 'svelte' ; 11import { describe , expect , it } from 'vitest' ; 12import { render } from 'vitest-browser-svelte' ; 13 14const MARKER = 'collapsible-body-marker' ; 15 16describe ( 'collapsible wrappers render their body lazily' , () => { 17for ( const variant of [ 'content' , 'terminal' ] as const ) { 18it ( ` ${ variant } : body is absent while closed and present once open` , async () => { 19const screen = render ( CollapsibleLazyBodyHarness , { open :false , variant}); 20 21await tick (); 22 23expect ( document . body . textContent ). not . toContain ( MARKER ); 24 25await screen . rerender ({ open :true , variant}); 26await tick (); 27 28expect ( document . body . textContent ). toContain ( MARKER ); 29 30// And it unmounts again on close, so a collapsed block stops costing 31// anything during streaming. 32await screen . rerender ({ open :false , variant}); 33await tick (); 34 35expect ( document . body . textContent ). not . toContain ( MARKER ); 36}); 37} 38});