@@ -69,6 +69,14 @@ const MessageItem = forwardRef<ListItemCustomDomRef, MessageItemPropTypes>((prop
6969 const titleTextRef = useRef < HTMLSpanElement > ( null ) ;
7070 const hasDetails = ! ! ( children || isTitleTextOverflowing ) ;
7171 const i18nBundle = useI18nBundle ( '@ui5/webcomponents-react' ) ;
72+ const titleTextStr = ( ( ) => {
73+ if ( typeof titleText === 'string' ) {
74+ return titleText ;
75+ } else if ( isValidElement < LinkPropTypes > ( titleText ) && typeof titleText . props . children === 'string' ) {
76+ return titleText . props . children ;
77+ }
78+ return '' ;
79+ } ) ( ) ;
7280
7381 useStylesheet ( styleData , MessageItem . displayName ) ;
7482
@@ -125,14 +133,6 @@ const MessageItem = forwardRef<ListItemCustomDomRef, MessageItemPropTypes>((prop
125133 } ;
126134 } , [ hasChildren ] ) ;
127135
128- useEffect ( ( ) => {
129- if ( typeof titleText === 'string' ) {
130- setTitleTextStr ( titleText ) ;
131- } else if ( isValidElement < LinkPropTypes > ( titleText ) && typeof titleText . props . children === 'string' ) {
132- setTitleTextStr ( titleText . props . children ) ;
133- }
134- } , [ titleText ] ) ;
135-
136136 return (
137137 < ListItemCustom
138138 onClick = { handleListItemClick }
@@ -148,10 +148,7 @@ const MessageItem = forwardRef<ListItemCustomDomRef, MessageItemPropTypes>((prop
148148 < div className = { classNames . iconContainer } >
149149 < Icon name = { getIconNameForType ( type as ValueState ) } className = { classNames . icon } mode = { IconMode . Decorative } />
150150 </ div >
151- < FlexBox
152- direction = { FlexBoxDirection . Column }
153- style = { { flex : 'auto' , whiteSpace : 'nowrap' , overflow : 'hidden' , textOverflow : 'ellipsis' } }
154- >
151+ < FlexBox direction = { FlexBoxDirection . Column } className = { classNames . titleContainer } >
155152 { titleText && (
156153 < span className = { classNames . title } ref = { titleTextRef } >
157154 { titleText }
0 commit comments