@@ -250,6 +250,11 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
250250 // Under new designs an overflowing list gives its last row to a "…" indicator.
251251 const overflows = createMemo ( ( ) => newDesigns ( ) && rows ( ) > limit ( ) )
252252 const height = createMemo ( ( ) => Math . min ( rows ( ) , limit ( ) ) - ( overflows ( ) ? 1 : 0 ) )
253+ // Computed once here so per-row details do not each call useTerminalDimensions(),
254+ // which registers one renderer resize listener per mounted row.
255+ const detailsWidth = createMemo ( ( ) =>
256+ dialogSelectContentWidth ( Math . min ( dialogWidth ( dialog . size ) , dimensions ( ) . width ) ) ,
257+ )
253258 const [ moreBelow , setMoreBelow ] = createSignal ( false )
254259 function updateMoreBelow ( ) {
255260 if ( ! scroll || scroll . isDestroyed ) return
@@ -778,7 +783,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
778783 gutter = { option . gutter }
779784 margin = { option . margin }
780785 />
781- < DialogSelectDetails details = { option . details } />
786+ < DialogSelectDetails details = { option . details } width = { detailsWidth ( ) } />
782787 </ box >
783788 )
784789 } }
@@ -899,11 +904,8 @@ function DialogSelectRow(props: {
899904 )
900905}
901906
902- function DialogSelectDetails ( props : { details ?: string [ ] } ) {
907+ function DialogSelectDetails ( props : { details ?: string [ ] ; width : number } ) {
903908 const theme = useTheme ( ) . surface ( "dialog" )
904- const dialog = useDialog ( )
905- const dimensions = useTerminalDimensions ( )
906- const width = createMemo ( ( ) => dialogSelectContentWidth ( Math . min ( dialogWidth ( dialog . size ) , dimensions ( ) . width ) ) )
907909 const newDesigns = useNewDesigns ( )
908910 return (
909911 < For each = { props . details } >
@@ -913,7 +915,7 @@ function DialogSelectDetails(props: { details?: string[] }) {
913915 paddingRight = { DIALOG_LIST_INSET - ( newDesigns ( ) ? 0 : 1 ) }
914916 >
915917 < text fg = { theme . text . muted } wrapMode = "none" >
916- { Locale . truncateMiddle ( detail , Math . max ( 1 , width ( ) ) ) }
918+ { Locale . truncateMiddle ( detail , Math . max ( 1 , props . width ) ) }
917919 </ text >
918920 </ box >
919921 ) }
0 commit comments