@@ -7,10 +7,7 @@ import type {
77 ShellChat ,
88 ShellQueryStatus ,
99} from '@/platform/app/(shell)/_components/model'
10- import {
11- LEGACY_DESTINATION ,
12- linkMenuActions ,
13- } from '@/platform/app/(shell)/_components/sidebar/row-links'
10+ import { linkMenuActions , readFormText } from '@/platform/app/(shell)/_components/sidebar/row-links'
1411import { SectionStatus } from '@/platform/app/(shell)/_components/sidebar/section-status'
1512import styles from '@/platform/app/(shell)/_components/sidebar/sidebar-collections.module.css'
1613import { useSidebarLayout } from '@/platform/app/(shell)/_components/sidebar/sidebar-layout'
@@ -222,14 +219,15 @@ export function ChatsSection({ chats, status, activeChat, actions, navigate }: C
222219 const href = item . href ?? `/chat/${ item . id } `
223220 const rows = rowActions ( item )
224221 const isCurrent = activeChat === item . id
222+ const selectOnMenuOpen = ( open : boolean ) => {
223+ if ( open && ! selected . has ( item . id ) ) selectOnly ( item . id )
224+ }
225225 return (
226226 < ContextActionMenu
227227 key = { item . id }
228228 label = { `Actions for ${ item . title } ` }
229229 actions = { rows }
230- onOpenChange = { ( open ) => {
231- if ( open && ! selected . has ( item . id ) ) selectOnly ( item . id )
232- } }
230+ onOpenChange = { selectOnMenuOpen }
233231 >
234232 < div
235233 className = { styles . row }
@@ -240,8 +238,7 @@ export function ChatsSection({ chats, status, activeChat, actions, navigate }: C
240238 selectOnly ( item . id )
241239 } }
242240 onPointerEnter = { ( ) => {
243- if ( ! isCurrent && ! LEGACY_DESTINATION . test ( href ) )
244- cancelPrefetch . current = actions . prefetch ?.( item . id ) ?? null
241+ if ( ! isCurrent ) cancelPrefetch . current = actions . prefetch ?.( item ) ?? null
245242 } }
246243 onPointerLeave = { ( ) => cancelPrefetch . current ?.( ) }
247244 >
@@ -256,9 +253,7 @@ export function ChatsSection({ chats, status, activeChat, actions, navigate }: C
256253 triggerSize = 'compact'
257254 align = 'end'
258255 actions = { rows }
259- onOpenChange = { ( open ) => {
260- if ( open && ! selected . has ( item . id ) ) selectOnly ( item . id )
261- } }
256+ onOpenChange = { selectOnMenuOpen }
262257 />
263258 }
264259 >
@@ -278,8 +273,7 @@ export function ChatsSection({ chats, status, activeChat, actions, navigate }: C
278273 title = 'Rename chat'
279274 confirmLabel = 'Save'
280275 onConfirm = { async ( values ) => {
281- const title = values . get ( 'title' )
282- const next = typeof title === 'string' ? title . trim ( ) : ''
276+ const next = readFormText ( values , 'title' )
283277 if ( ! next ) throw new Error ( 'Enter a chat name.' )
284278 if ( next !== renamingChat . title ) await actions . rename ( renamingChat . id , next )
285279 } }
@@ -307,8 +301,7 @@ export function ChatsSection({ chats, status, activeChat, actions, navigate }: C
307301 { removing . length === 1
308302 ? `${ actions . removeLabel } “${ removing [ 0 ] . title } ”?`
309303 : `${ actions . removeLabel } ${ removing . length } chats?` }
310- { actions . removeLabel === 'Delete' &&
311- ` You can restore ${ removing . length === 1 ? 'it' : 'them' } from Recently deleted in Settings.` }
304+ { actions . removeDetail && ` ${ actions . removeDetail ( removing . length ) } ` }
312305 </ p >
313306 </ Modal >
314307 ) }
0 commit comments